Skip to content

ymendel/markov

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

simple markov chains

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages