Browse Source

Trim lines & split multiple words on a line up

master
Starbeamrainbowlabs 3 years ago
parent
commit
a6564e4ce7
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      MarkovGrams/Program.cs

+ 2
- 1
MarkovGrams/Program.cs View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MarkovGrams
{
@ -19,7 +20,7 @@ namespace MarkovGrams
int order = int.Parse(args[1]);
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);
UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams);


Loading…
Cancel
Save