public string GetWord() { var word = new StringBuilder(); var nextLetter = Corpus.GetFirstLetter(Random.NextDouble() * Corpus.FirstLetterTotalWeight); while (nextLetter.Letter != " ") { word.Append(nextLetter.Letter); var currentLetter = Corpus.GetLetter(nextLetter.Letter); nextLetter = NextLetterInWord(currentLetter); } return(word.ToString()); }
public void Initialize(int seed = NoSeed) { Corpus = new Corpus(DataFilepath); Random = seed == NoSeed ? new Random() : new Random(seed); }