FreeLing
4.0
|
#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 bigram &, const bigram &, int kb, double) |
add new element to the trellis | |
double | delta (int, const bigram &, unsigned int k=0) const |
retieve delta component for kth best path (count starts at 0) for given T and state. | |
std::pair< bigram, int > | phi (int, const bigram &, unsigned int k=0) const |
retieve phi component for kth best path (count starts at 0) for given T and state | |
int | nbest (int, const bigram &) const |
Get number of elements in kbest set for given time&state (at most kbest, maybe less) | |
Static Public Attributes | |
static const float | ZERO_logprob = -numeric_limits<float>::infinity() |
log prob for zero | |
static const bigram | initState = bigram(L"0",L"0") |
static const bigram | endState = bigram(L"ENDSTATE",L"ENDSTATE") |
Private Types | |
typedef std::multiset< element, std::greater< element > > | path_elements |
Trellis: array of columns. | |
Private Attributes | |
std::vector< std::map< bigram, path_elements > > | trl |
unsigned int | kbest |
Number of kbest paths to store. |
typedef std::multiset<element,std::greater<element> > freeling::trellis::path_elements [private] |
Trellis: array of columns.
Each column associates each state with a set of path elements sorted by descending probability
freeling::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 freeling::trellis::delta | ( | int | t, |
const bigram & | s, | ||
unsigned int | k = 0 |
||
) | const |
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 freeling::trellis::insert | ( | int | t, |
const bigram & | s, | ||
const bigram & | sa, | ||
int | kb, | ||
double | p | ||
) |
add new element to the trellis
insert a new arc in the trellis.
Time t, state s, prev state sa, prob p
References int2wstring, and TRACE.
int freeling::trellis::nbest | ( | int | t, |
const bigram & | s | ||
) | const |
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.
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.
const bigram freeling::trellis::endState = bigram(L"ENDSTATE",L"ENDSTATE") [static] |
const bigram freeling::trellis::initState = bigram(L"0",L"0") [static] |
unsigned int freeling::trellis::kbest [private] |
Number of kbest paths to store.
std::vector<std::map <bigram, path_elements > > freeling::trellis::trl [private] |
const float freeling::trellis::ZERO_logprob = -numeric_limits<float>::infinity() [static] |
log prob for zero
Referenced by freeling::hmm_tagger::annotate(), and freeling::hmm_tagger::ProbPi_log().