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

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)