edu.cmu.sphinx.linguist.flat
Class GrammarPoint

java.lang.Object
  extended byedu.cmu.sphinx.linguist.flat.GrammarPoint

public class GrammarPoint
extends java.lang.Object

Manages a particular point in a grammar. The GrammarPoint is used to manage the look-ahead for generating right-contexts. Since we haven't built the HMM tree yet, looking ahead can be difficult. The GrammarPoint class points to a particular unit within a pronunciation/word/grammar. From a particular grammar point, it is possible to get the set of next grammar points.


Constructor Summary
GrammarPoint(GrammarNode node)
          Creates a grammar node that points to the first unit of the first pronunciation of the first word of the given grammar node
GrammarPoint(GrammarNode node, int alternativeIndex, int wordIndex, int pronunciationIndex, int unitIndex)
          Creates a GrammarPoint that points to a fully specified unit
GrammarPoint(PronunciationState state, int which)
          Creates a GrammarPoint that corresponds to the given unit of the given pronunciation
GrammarPoint(SentenceHMMState state)
          Creates a grammar point that points to the given unit of the given pronunciation state.
 
Method Summary
 java.util.List getRightContexts(int size, boolean startWithCurrent, int maxContexts)
          Gets all of the right contexts for this grammar point.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarPoint

public GrammarPoint(SentenceHMMState state)
Creates a grammar point that points to the given unit of the given pronunciation state.

Parameters:
state - the pronunciation of interest

GrammarPoint

public GrammarPoint(GrammarNode node)
Creates a grammar node that points to the first unit of the first pronunciation of the first word of the given grammar node

Parameters:
node - the grammar node of interest

GrammarPoint

public GrammarPoint(PronunciationState state,
                    int which)
Creates a GrammarPoint that corresponds to the given unit of the given pronunciation

Parameters:
state - the pronunciation state
which - the index of the unit

GrammarPoint

public GrammarPoint(GrammarNode node,
                    int alternativeIndex,
                    int wordIndex,
                    int pronunciationIndex,
                    int unitIndex)
Creates a GrammarPoint that points to a fully specified unit

Parameters:
node - the grammar node
wordIndex - the index of the word in the node
pronunciationIndex - the index of the pronunciation in the word.
unitIndex - the index of the unit in the pronunciation
Method Detail

getRightContexts

public java.util.List getRightContexts(int size,
                                       boolean startWithCurrent,
                                       int maxContexts)
Gets all of the right contexts for this grammar point. The contexts returned are guaranteed to be 'size' units in length, The number of contexts returned depends upon the perplexity of the grammar downstream from this GrammarPoint

Parameters:
size - the size of each context returned
startWithCurrent - include the current state in the context
maxContexts - the maxium number of right contexts to return
Returns:
a list of containing Unit[] contexts.