A hidden Markov model implementation