Skip to content
/ ruffini Public

a markov library for ruby which emphasizes minimalism and a heightened degree of control

License

Notifications You must be signed in to change notification settings

ix/ruffini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruffini

Ruffini is a markov text library that is small, straightforward and allows you to do things like set the dictionary entry from which new text will be generated.

Check out this usage example:

require 'ruffini'

EXAMPLE = <<~TEXT 
  I like apples and strawberries.
  I like cheese and ham.
  I like tea and coffee.
  I like sunsets and rainy days.
TEXT

# first parameter denotes the 'depth' of the database
database = Ruffini::Markov.new(1)

database.parse! EXAMPLE

# generate up to 10 words at random
puts database.generate(10)

# provide an initial string to start generating from!
puts database.generate(10, "I")

# we could save the database for later use! 
# database.save! "my_database.markov"

# then load it like this
# database = Ruffini::Markov.new(1, "my_database.markov")
# depth must remain the same!

About

a markov library for ruby which emphasizes minimalism and a heightened degree of control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages