latest version v1.9 - last update 10 Apr 2010 |
This class allows online classification of word chains. More...
#include <ltiHmmOnlineClassifier.h>
Classes | |
class | parameters |
the parameters for the class hmmOnlineClassifier More... | |
Public Member Functions | |
hmmOnlineClassifier () | |
hmmOnlineClassifier (const hmmOnlineClassifier &other) | |
virtual | ~hmmOnlineClassifier () |
virtual const char * | getTypeName () const |
hmmOnlineClassifier & | copy (const hmmOnlineClassifier &other) |
hmmOnlineClassifier & | operator= (const hmmOnlineClassifier &other) |
virtual classifier * | clone () const |
const parameters & | getParameters () const |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Online classification routines. | |
void | reset () |
void | initialize () |
bool | classify (const dvector &observation) |
trace back routines | |
ivector | partialTraceBack () |
ivector | partialTraceBack (ivector &wordLength, dvector &wordEndScores) |
ivector | fullTraceBack () const |
ivector | fullTraceBack (ivector &wordLength, dvector &wordEndScores) const |
ivector | bestHypothesisTraceBack () const |
ivector | bestHypothesisTraceBack (int &innerState, ivector &wordLength, dvector &wordEndScores) const |
int | getNumberOfHypotheses () const |
word error routines | |
int | wordErrorCount (const ivector &wordSequence1, const ivector &wordSequence2) const |
float | wordErrorRate (const ivector &correctSequence, const ivector &classifiedSequence) const |
This class allows online classification of word chains.
lti::hmmOnlineClassifier::hmmOnlineClassifier | ( | ) |
default constructor
lti::hmmOnlineClassifier::hmmOnlineClassifier | ( | const hmmOnlineClassifier & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::hmmOnlineClassifier::~hmmOnlineClassifier | ( | ) | [virtual] |
destructor
ivector lti::hmmOnlineClassifier::bestHypothesisTraceBack | ( | int & | innerState, | |
ivector & | wordLength, | |||
dvector & | wordEndScores | |||
) | const |
Full traceback of the best active hypothesis.
Return the word sequence leading to the currently best hypotheses. Note, that this hypothesis might not be in a word-end-state.
innerState | the active state of the hypothesis is saved here. the according model is given by the last entry of the return vector. | |
wordLength | the length of each classified word is saved here. | |
wordEndScores | the score of the word end hypotheses is saved here. |
ivector lti::hmmOnlineClassifier::bestHypothesisTraceBack | ( | ) | const |
bool lti::hmmOnlineClassifier::classify | ( | const dvector & | observation | ) |
Online classification step.
observation | the observation of this timestep. |
virtual classifier* lti::hmmOnlineClassifier::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::hmmClassifier.
hmmOnlineClassifier& lti::hmmOnlineClassifier::copy | ( | const hmmOnlineClassifier & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::hmmClassifier.
ivector lti::hmmOnlineClassifier::fullTraceBack | ( | ) | const |
int lti::hmmOnlineClassifier::getNumberOfHypotheses | ( | ) | const [inline] |
const parameters& lti::hmmOnlineClassifier::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::hmmClassifier.
virtual const char* lti::hmmOnlineClassifier::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("hmmOnlineClassifier")
Reimplemented from lti::hmmClassifier.
void lti::hmmOnlineClassifier::initialize | ( | ) |
Empty traceback fields and delete current hypotheses.
This routine must be called before a new online classification session is started.
Reimplemented from lti::object.
hmmOnlineClassifier& lti::hmmOnlineClassifier::operator= | ( | const hmmOnlineClassifier & | other | ) |
alias for copy member
other | the classifier to be copied |
Reimplemented from lti::hmmClassifier.
ivector lti::hmmOnlineClassifier::partialTraceBack | ( | ivector & | wordLength, | |
dvector & | wordEndScores | |||
) |
Perform partial traceback.
Find the latest timeframe left to where the word sequence is fixed, i.e. find the start of a sentence where later hypotheses have no effect on. This word sequence is returned and the internal traceback fields are truncated accordingly. Furthermore, the internal scores of all current hypotheses are reduced.
wordLength | the length of each classified word is saved here. | |
wordEndScores | the score of the word end hypotheses is saved here. |
ivector lti::hmmOnlineClassifier::partialTraceBack | ( | ) |
Perform partial traceback.
Find the latest timeframe left to where the word sequence is fixed, i.e. find the start of a sentence where later hypotheses have no effect on. This word sequence is returned and the internal traceback fields are truncated accordingly. Furthermore, the internal scores of all current hypotheses are reduced.
virtual bool lti::hmmOnlineClassifier::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
read method
Reimplemented from lti::hmmClassifier.
void lti::hmmOnlineClassifier::reset | ( | ) |
delete all models, hypotheses and traceback fields.
Reimplemented from lti::hmmClassifier.
int lti::hmmOnlineClassifier::wordErrorCount | ( | const ivector & | wordSequence1, | |
const ivector & | wordSequence2 | |||
) | const |
Calculate the Levenshtein distance (also called edit distance).
The Levenshtein distance of two sentences is the minimum number of substitutions, insertions and deletions needed to transform one sentence into the other.
Referenced by wordErrorRate().
float lti::hmmOnlineClassifier::wordErrorRate | ( | const ivector & | correctSequence, | |
const ivector & | classifiedSequence | |||
) | const [inline] |
The word error rate is defined as the Levenshtein distance divided by the length of the correct word sequence.
References lti::genericVector< T >::size(), and wordErrorCount().
virtual bool lti::hmmOnlineClassifier::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
write method
Reimplemented from lti::hmmClassifier.