Hidden Markov Model in Ruby