CLI: Ignore blank lines

This commit is contained in:
Starbeamrainbowlabs 2018-09-03 21:20:04 +01:00
parent 6b79d8c5bb
commit e9cc40f335
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,9 @@ namespace MarkovGrams
IEnumerable<string> words = wordlistSource.ReadAllLines().SelectMany((string word) => { IEnumerable<string> words = wordlistSource.ReadAllLines().SelectMany((string word) => {
word = word.Trim(); word = word.Trim();
// No blank lines here!
if (string.IsNullOrWhiteSpace(word)) return new string[] { };
if (convertLowercase) if (convertLowercase)
word = word.ToLower(); word = word.ToLower();
if (splitOnWhitespace) if (splitOnWhitespace)