Simple implementation of inference algorithms on Hidden Markov Models