Trim lines & split multiple words on a line up

This commit is contained in:
Starbeamrainbowlabs 2017-04-26 21:43:45 +01:00
parent b91e42770c
commit a6564e4ce7
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
namespace MarkovGrams namespace MarkovGrams
{ {
@ -19,7 +20,7 @@ namespace MarkovGrams
int order = int.Parse(args[1]); int order = int.Parse(args[1]);
int desiredStringLength = int.Parse(args[2]); int desiredStringLength = int.Parse(args[2]);
IEnumerable<string> words = File.ReadLines(wordlistFilename); IEnumerable<string> words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
IEnumerable<string> ngrams = NGrams.GenerateFlat(words, order); IEnumerable<string> ngrams = NGrams.GenerateFlat(words, order);
UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams); UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams);