Trim lines & split multiple words on a line up
This commit is contained in:
parent
b91e42770c
commit
a6564e4ce7
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue