an implement of viterbi algorithm for specific application