edu.cmu.sphinx.result
Class SimpleWordResult

java.lang.Object
  extended byedu.cmu.sphinx.result.SimpleWordResult
All Implemented Interfaces:
WordResult

public class SimpleWordResult
extends java.lang.Object
implements WordResult

Represents a single word result with associated scoring and timing information.

Author:
pgorniak

Constructor Summary
SimpleWordResult(Node node, double confidence, LogMath logMath)
          Construct a WordResult using a Node object and a confidence (posterior).
SimpleWordResult(java.lang.String w, double confidence, LogMath logMath)
          Construct a word result from a string and a confidence score.
SimpleWordResult(Word w, int sf, int ef, double score, double confidence, LogMath logMath)
          Construct a word result with full information.
 
Method Summary
 double getConfidence()
          Returns a log confidence score for this WordResult.
 Data[] getDataFrames()
          Gets the feature frames associated with this word
 int getEndFrame()
          Gets the ending frame number for the word
 LogMath getLogMath()
          Returns the log math of the scores.
 Pronunciation getPronunciation()
          Gets the pronunciation for this word.
 double getScore()
          Gets the total score for this word.
 int getStartFrame()
          Gets the starting frame number for the word
 java.lang.String toString()
          Return this WordResult as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleWordResult

public SimpleWordResult(java.lang.String w,
                        double confidence,
                        LogMath logMath)
Construct a word result from a string and a confidence score. Note that

Parameters:
w - the word
confidence - the confidence for this word

SimpleWordResult

public SimpleWordResult(Word w,
                        int sf,
                        int ef,
                        double score,
                        double confidence,
                        LogMath logMath)
Construct a word result with full information.

Parameters:
w - the word object to store
sf - word start time
ef - word end time
score - score of the word
confidence - confidence (posterior) of the word

SimpleWordResult

public SimpleWordResult(Node node,
                        double confidence,
                        LogMath logMath)
Construct a WordResult using a Node object and a confidence (posterior). This does not use the posterior stored in the Node object, just its word, start and end. TODO: score is currently set to zero

Parameters:
node - the node to extract information from
confidence - the confidence (posterior) to assign
Method Detail

getScore

public double getScore()
Description copied from interface: WordResult
Gets the total score for this word.

Specified by:
getScore in interface WordResult
Returns:
the score for the word (in LogMath log base)
See Also:
WordResult.getScore()

getConfidence

public double getConfidence()
Description copied from interface: WordResult
Returns a log confidence score for this WordResult. Use the getLogMath().logToLinear() method to convert the log confidence score to linear. The linear value should be between 0.0 and 1.0 (inclusive) for this word.

Specified by:
getConfidence in interface WordResult
Returns:
a log confidence score which linear value is between 0.0 and 1.0 (inclusive)
See Also:
WordResult.getConfidence()

getLogMath

public LogMath getLogMath()
Description copied from interface: WordResult
Returns the log math of the scores.

Specified by:
getLogMath in interface WordResult
Returns:
the log math of the scores
See Also:
WordResult.getLogMath()

getPronunciation

public Pronunciation getPronunciation()
Description copied from interface: WordResult
Gets the pronunciation for this word.

Specified by:
getPronunciation in interface WordResult
Returns:
the pronunciation for the word
See Also:
WordResult.getPronunciation()

getStartFrame

public int getStartFrame()
Description copied from interface: WordResult
Gets the starting frame number for the word

Specified by:
getStartFrame in interface WordResult
Returns:
the starting frame number for the word
See Also:
WordResult.getStartFrame()

getEndFrame

public int getEndFrame()
Description copied from interface: WordResult
Gets the ending frame number for the word

Specified by:
getEndFrame in interface WordResult
Returns:
the ending frame number for the word
See Also:
WordResult.getEndFrame()

toString

public java.lang.String toString()
Return this WordResult as a string.

Specified by:
toString in interface WordResult
Returns:
the word stored here as a string

getDataFrames

public Data[] getDataFrames()
Description copied from interface: WordResult
Gets the feature frames associated with this word

Specified by:
getDataFrames in interface WordResult
Returns:
the set of feature frames associated with this word, or null if the frames are not available.
See Also:
WordResult.getDataFrames()