edu.cmu.sphinx.linguist.acoustic
Class LeftRightContext

java.lang.Object
  extended byedu.cmu.sphinx.linguist.acoustic.Context
      extended byedu.cmu.sphinx.linguist.acoustic.LeftRightContext
All Implemented Interfaces:
java.io.Serializable

public class LeftRightContext
extends Context

Represents the context for a unit

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.cmu.sphinx.linguist.acoustic.Context
EMPTY_CONTEXT
 
Method Summary
static LeftRightContext get(Unit[] leftContext, Unit[] rightContext)
          Factory method for creating a left/right context
static java.lang.String getContextName(Unit[] context)
          Gets the context name for a particular array of units
 Unit[] getLeftContext()
          Retrieves the left context for this unit
 Unit[] getRightContext()
          Retrieves the right context for this unit
 boolean isPartialMatch(Context context)
          Checks to see if there is a partial match with the given context.
 java.lang.String toString()
          Provides a string representation of a context
 
Methods inherited from class edu.cmu.sphinx.linguist.acoustic.Context
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Provides a string representation of a context

Overrides:
toString in class Context

get

public static LeftRightContext get(Unit[] leftContext,
                                   Unit[] rightContext)
Factory method for creating a left/right context

Parameters:
leftContext - the left context or null if no left context
rightContext - the right context or null if no right context
Returns:
a left right context

getLeftContext

public Unit[] getLeftContext()
Retrieves the left context for this unit

Returns:
the left context

getRightContext

public Unit[] getRightContext()
Retrieves the right context for this unit

Returns:
the right context

getContextName

public static java.lang.String getContextName(Unit[] context)
Gets the context name for a particular array of units

Parameters:
context - the context
Returns:
the context name

isPartialMatch

public boolean isPartialMatch(Context context)
Checks to see if there is a partial match with the given context. If both contexts are LeftRightContexts then a left or right context that is null is considered a wild card and matches anything, othewise the contexts must match exactly. Anything matches the Context.EMPTY_CONTEXT

Overrides:
isPartialMatch in class Context
Parameters:
context - the context to check
Returns:
true if there is a partial match