Decoding a hidden Markov model with the Viterbi algorithm