markov
DESCRIPTION:
A simple Markov chain implementation.
FEATURES/PROBLEMS:
-
Presently only uses chains of length 1
SYNOPSIS:
require 'markov'
m = Markov.new
words = [ ... ]
m.add(*words)
m.generate(10) # => ["show", "off", "what", "Houston", "is", "far", "from", "a", "cow", "grazing"]
m.reset
m.add(*(1..10).to_a)
m.add(2,4,6,8)
m.add(1,3,5,7,9)
m.add(1,5,7)
m.add(2,6,10)
m.generate # => [2, 3, 5, 6, 10]
REQUIREMENTS:
-
Ruby
INSTALL:
-
gem install markov