ModErn Text Analysis
META Enumerates Textual Applications
|
Special trellis for the Viterbi algorithm. More...
#include <trellis.h>
Public Member Functions | |
viterbi_trellis (uint64_t size, uint64_t labels) | |
Constructs a viterbi_trellis with the given number of time steps and labels. More... | |
void | previous_tag (uint64_t idx, const label_id ¤t, const label_id &previous) |
Sets the back pointer for the given time step and label to the given label. More... | |
const label_id & | previous_tag (uint64_t idx, const label_id ¤t) const |
Public Member Functions inherited from meta::sequence::trellis | |
trellis (uint64_t size, uint64_t labels) | |
Constructs a new trellis with the given number of time steps and labels. More... | |
uint64_t | size () const |
void | probability (uint64_t idx, const label_id &tag, double prob) |
Sets the value in the trellis for the given time step and label. More... | |
double | probability (uint64_t idx, const label_id &tag) const |
Obtains the value in the trellis for the given time step and label. More... | |
Private Attributes | |
util::dense_matrix< label_id > | paths_ |
storage for the back pointers | |
Additional Inherited Members | |
Protected Attributes inherited from meta::sequence::trellis | |
util::dense_matrix< double > | trellis_ |
storage for the scores | |
Special trellis for the Viterbi algorithm.
In addition to storing the scores like a normal trellis, it also can store back pointers indicating the best possible path for each node at each time step.
meta::sequence::viterbi_trellis::viterbi_trellis | ( | uint64_t | size, |
uint64_t | labels | ||
) |
Constructs a viterbi_trellis with the given number of time steps and labels.
size | The number of time steps |
labels | The number of labels |
void meta::sequence::viterbi_trellis::previous_tag | ( | uint64_t | idx, |
const label_id & | current, | ||
const label_id & | previous | ||
) |
Sets the back pointer for the given time step and label to the given label.
idx | The time step |
current | The current label |
previous | The best previous tag for the current label |
const label_id & meta::sequence::viterbi_trellis::previous_tag | ( | uint64_t | idx, |
const label_id & | current | ||
) | const |
idx | The time step |
current | The label |