Scala implementation of a Hidden Markov Model