LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::hmmOnlineClassifier Class Reference

This class allows online classification of word chains. More...

#include <ltiHmmOnlineClassifier.h>

Inheritance diagram for lti::hmmOnlineClassifier:
Inheritance graph
[legend]
Collaboration diagram for lti::hmmOnlineClassifier:
Collaboration graph
[legend]

List of all members.

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
hmmOnlineClassifiercopy (const hmmOnlineClassifier &other)
hmmOnlineClassifieroperator= (const hmmOnlineClassifier &other)
virtual classifierclone () const
const parametersgetParameters () const
virtual bool write (ioHandler &handler, const bool complete=true) const
virtual bool read (ioHandler &handler, const bool complete=true)
Online classification routines.

These methods are used for online classification.



void reset ()
void initialize ()
bool classify (const dvector &observation)
trace back routines

These methods are used to determine the best word sequence.



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

These methods are used to determine the word error rate of a classified sentence.



int wordErrorCount (const ivector &wordSequence1, const ivector &wordSequence2) const
float wordErrorRate (const ivector &correctSequence, const ivector &classifiedSequence) const

Detailed Description

This class allows online classification of word chains.


Constructor & Destructor Documentation

lti::hmmOnlineClassifier::hmmOnlineClassifier (  ) 

default constructor

lti::hmmOnlineClassifier::hmmOnlineClassifier ( const hmmOnlineClassifier other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::hmmOnlineClassifier::~hmmOnlineClassifier (  )  [virtual]

destructor


Member Function Documentation

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.

Parameters:
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.
Returns:
vector describing a sequence of word ids.
ivector lti::hmmOnlineClassifier::bestHypothesisTraceBack (  )  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.

Returns:
vector describing a sequence of word ids.
bool lti::hmmOnlineClassifier::classify ( const dvector observation  ) 

Online classification step.

Parameters:
observation the observation of this timestep.
Returns:
false if an error occurred during classification else true
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.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::hmmClassifier.

ivector lti::hmmOnlineClassifier::fullTraceBack ( ivector wordLength,
dvector wordEndScores 
) const

Full word sequence traceback Return the best word sequence, given the assumption that the word has ended.

Parameters:
wordLength the length of each classified word is saved here.
wordEndScores the score of the word end hypotheses is saved here.
Returns:
vector describing a sequence of word ids.
ivector lti::hmmOnlineClassifier::fullTraceBack (  )  const

Full word sequence traceback Return the best word sequence, given the assumption that the word has ended.

Returns:
vector describing a sequence of word ids.
int lti::hmmOnlineClassifier::getNumberOfHypotheses (  )  const [inline]
Returns:
number of currently active hypotheses.
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

Parameters:
other the classifier to be copied
Returns:
a reference to this classifier object

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.

Parameters:
wordLength the length of each classified word is saved here.
wordEndScores the score of the word end hypotheses is saved here.
Returns:
vector describing a sequence of word ids.
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.

Returns:
vector describing a sequence of word ids.
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.

Returns:
Levenshtein distance of the given word sequences

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.

Returns:
word error rate

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.


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

Generated on Sat Apr 10 15:26:51 2010 for LTI-Lib by Doxygen 1.6.1