Fix markov chain generation to base the next ngram on the previous one - not the first one
This commit is contained in:
parent
a6564e4ce7
commit
03fad1ab78
1 changed files with 1 additions and 0 deletions
|
@ -64,6 +64,7 @@ namespace MarkovGrams
|
||||||
string nextNgram = nextNgrams.ElementAt(rand.Next(0, nextNgrams.Count));
|
string nextNgram = nextNgrams.ElementAt(rand.Next(0, nextNgrams.Count));
|
||||||
// Add the last character from the n-gram to the string we're building
|
// Add the last character from the n-gram to the string we're building
|
||||||
result += nextNgram[nextNgram.Length - 1];
|
result += nextNgram[nextNgram.Length - 1];
|
||||||
|
lastNgram = nextNgram;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue