edu.cmu.sphinx.result
Class ConfusionSet

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap
          extended by edu.cmu.sphinx.result.ConfusionSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, java.util.NavigableMap, 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

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
ConfusionSet()
           
 
Method Summary
 void addWordHypothesis(WordResult word)
          Add a word hypothesis to this confusion set.
 boolean containsFiller()
          Check whether this confusion set contains any fillers.
 boolean containsWord(java.lang.String word)
          Check whether this confusion set contains the given word
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, size, subMap, subMap, tailMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty
 
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

containsWord

public boolean containsWord(java.lang.String word)
Check whether this confusion set contains the given word

Parameters:
word - the word to look for
Returns:
true if word is in this set

containsFiller

public boolean containsFiller()
Check whether this confusion set contains any fillers.

Returns:
whether fillers are found

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

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap