Markovian is a Ruby library that let you deal with all Markov models.