|
FreeLing
3.0
|
The class viterbi stores the two maps for each observation: The delta map stores the maximum probability for each state in that observation, the phi map stores the backpath to maximize the probability. More...
#include <hmm_tagger.h>
Classes | |
| class | element |
| Each trellis node contains an ordered set of paths. More... | |
Public Member Functions | |
| trellis (int, unsigned int kb=1) | |
| Constructor. | |
| ~trellis () | |
| Destructor. | |
| void | insert (int, const std::wstring &, const std::wstring &, int kb, double) |
| add new element to the trellis | |
| double | delta (int, const std::wstring &, unsigned int k=0) |
| retieve delta component for kth best path (count starts at 0) for given T and state. | |
| std::pair< std::wstring, int > | phi (int, const std::wstring &, unsigned int k=0) |
| retieve phi component for kth best path (count starts at 0) for given T and state | |
| int | nbest (int, const std::wstring &) |
| Get number of elements in kbest set for given time&state (at most kbest, maybe less) | |
Static Public Attributes | |
| static float | ZERO_logprob |
| log prob for zero | |
Private Attributes | |
| std::map< std::wstring, std::multiset< element > > * | trl |
| Trellis: array of columns. | |
| unsigned int | kbest |
| Number of kbest paths to store. | |
The class viterbi stores the two maps for each observation: The delta map stores the maximum probability for each state in that observation, the phi map stores the backpath to maximize the probability.
An instance of this class is created for each sentence to be tagged, and destroyed when work is finished.
| trellis::trellis | ( | int | T, |
| unsigned int | kb = 1 |
||
| ) |
Constructor.
Constructor: Create dynammic storage for delta and phi tables in the trellis.
Destructor.
Destructor: Free dynammic storage for delta and phi tables stored in the trellis.
| double trellis::delta | ( | int | , |
| const std::wstring & | , | ||
| unsigned int | k = 0 |
||
| ) |
retieve delta component for kth best path (count starts at 0) for given T and state.
Get delta component for kth best path (count from 0)
References ERROR_CRASH.
| void trellis::insert | ( | int | , |
| const std::wstring & | , | ||
| const std::wstring & | , | ||
| int | kb, | ||
| double | |||
| ) |
add new element to the trellis
insert a new arc in the trellis.
Time t, state s, prev state sa, prob p
References util::int2wstring(), and TRACE.
| int trellis::nbest | ( | int | , |
| const std::wstring & | |||
| ) |
Get number of elements in kbest set for given time&state (at most kbest, maybe less)
Get number of elements in kbest set for time t, state s.
| pair< wstring, int > trellis::phi | ( | int | , |
| const std::wstring & | , | ||
| unsigned int | k = 0 |
||
| ) |
retieve phi component for kth best path (count starts at 0) for given T and state
Get phi component for kth best path (count from 0)
References ERROR_CRASH.
unsigned int trellis::kbest [private] |
Number of kbest paths to store.
std::map<std::wstring, std::multiset<element> >* trellis::trl [private] |
Trellis: array of columns.
Each column associates each state with a set of path elements
float trellis::ZERO_logprob [static] |
log prob for zero
Referenced by hmm_tagger::annotate(), and hmm_tagger::ProbPi_log().
1.7.6.1