2.0.8 -- different generation algorithm
This commit is contained in:
parent
e87dc5862b
commit
00f0228dd4
24 changed files with 127 additions and 27 deletions
3
lib/twitter_ebooks/markov.rb
Normal file → Executable file
3
lib/twitter_ebooks/markov.rb
Normal file → Executable 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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue