ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Private Attributes | List of all members
meta::sequence::viterbi_trellis Class Reference

Special trellis for the Viterbi algorithm. More...

#include <trellis.h>

Inheritance diagram for meta::sequence::viterbi_trellis:
meta::sequence::trellis

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 &current, 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 &current) 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
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
sizeThe number of time steps
labelsThe number of labels

Member Function Documentation

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.

Parameters
idxThe time step
currentThe current label
previousThe best previous tag for the current label
const label_id & meta::sequence::viterbi_trellis::previous_tag ( uint64_t  idx,
const label_id &  current 
) const
Parameters
idxThe time step
currentThe label
Returns
the back pointer for the given time step and label.

The documentation for this class was generated from the following files: