From e9cc40f33553bdcb2f93fd8d1e100d280f8682c4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 3 Sep 2018 21:20:04 +0100 Subject: [PATCH] CLI: Ignore blank lines --- MarkovGrams/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MarkovGrams/Program.cs b/MarkovGrams/Program.cs index 2d3134d..1380786 100644 --- a/MarkovGrams/Program.cs +++ b/MarkovGrams/Program.cs @@ -84,6 +84,9 @@ namespace MarkovGrams IEnumerable words = wordlistSource.ReadAllLines().SelectMany((string word) => { word = word.Trim(); + // No blank lines here! + if (string.IsNullOrWhiteSpace(word)) return new string[] { }; + if (convertLowercase) word = word.ToLower(); if (splitOnWhitespace)