Tanl Linguistic Pipeline |
This is the good old Viterbi algorithm for HMM decoding. More...
#include <Viterbi.h>
Classes | |
struct | Node |
Public Member Functions | |
Viterbi (HMM &hmm) | |
std::vector< State > | decode (double logtheta, State &startState, HMM::Observations &observations) |
logtheta is used for beam pruning. |
This is the good old Viterbi algorithm for HMM decoding.
Viterbi doesn't deal with the structure of an HMM. It only needs a start state and a black box that calculates the following states with transition and emission probabilities. The abstract class HMM
provides a method
Transition's
from a given state and a given observation.We do not have any trellis: at every step we only record the set of possible states with their weight and preceeding state. This structure is called Node. The nodes which have been reached at step t are stored in a map. The keys are states, the values are nodes. The type of states is parametric.
vector< State > Tanl::POS::Viterbi::decode | ( | double | logtheta, | |
State & | startState, | |||
HMM::Observations & | observations | |||
) |
logtheta is used for beam pruning.
References Tanl::POS::Viterbi::Node::from, and Tanl::POS::Viterbi::Node::weight.