edu.cmu.sphinx.result
Class ConfusionSet

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.TreeMap
          extended byedu.cmu.sphinx.result.ConfusionSet
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable, java.util.SortedMap

public class ConfusionSet
extends java.util.TreeMap

A confusion set is a set of words with their associated posteriors. In Java terms it's a SortedMap from posteriors to sets of WordResults, but the class is called a set because that's what this beast is known as in the literature.

Author:
pgorniak
See Also:
Serialized Form

Constructor Summary
ConfusionSet()
           
 
Method Summary
 void addWordHypothesis(WordResult word)
          Add a word hypothesis to this confusion set.
 void dump(java.lang.String name)
          Dumps out the contents of this ConfusionSet.
 WordResult getBestHypothesis()
          Return the single best hypothesis.
 java.util.Set getBestHypothesisSet()
          Return the set of best hypothesis.
 double getBestPosterior()
          Get the highest posterior (confidence) stored in this set.
 WordResult getWordResult(java.lang.String word)
          Returns the WordResult in this ConfusionSet for the given word.
 java.util.Set getWordSet(double posterior)
          Get the word set with this confidence.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

ConfusionSet

public ConfusionSet()
Method Detail

addWordHypothesis

public void addWordHypothesis(WordResult word)
Add a word hypothesis to this confusion set.

Parameters:
word - the hypothesis to add

getWordSet

public java.util.Set getWordSet(double posterior)
Get the word set with this confidence.

Parameters:
posterior - the confidence (posterior)
Returns:
a set of hypotheses with this confidence, null if no such hypotheses

getBestHypothesisSet

public java.util.Set getBestHypothesisSet()
Return the set of best hypothesis. This will usually contain one hypothesis, but might contain more case there are some that have exactly equal confidences.

Returns:
a set of best hypotheses

getBestHypothesis

public WordResult getBestHypothesis()
Return the single best hypothesis. Breaks ties arbitrarily.

Returns:
the best hypothesis stored in this confusion set (by confidence)

getBestPosterior

public double getBestPosterior()
Get the highest posterior (confidence) stored in this set.

Returns:
the highes posterior

getWordResult

public WordResult getWordResult(java.lang.String word)
Returns the WordResult in this ConfusionSet for the given word.

Parameters:
word - the word to look for
Returns:
the WordResult for the given word, or null if no WordResult for the given word is found

dump

public void dump(java.lang.String name)
Dumps out the contents of this ConfusionSet.

Parameters:
name - the name of the confusion set