2.0.8 -- different generation algorithm

This commit is contained in:
Mispy 2013-11-14 07:44:05 -08:00
parent e87dc5862b
commit 00f0228dd4
24 changed files with 127 additions and 27 deletions

3
lib/twitter_ebooks/markov.rb Normal file → Executable file
View file

@ -54,9 +54,10 @@ module Ebooks
def chain(tokens)
if tokens.length == 1
matches = @unigrams[tokens[0]]
matches = @unigrams[tokens[-1]]
else
matches = @bigrams[tokens[-2]][tokens[-1]]
matches = @unigrams[tokens[-1]] if matches.length < 2
end
if matches.empty?