edu.cmu.sphinx.linguist.acoustic
Class Unit

java.lang.Object
  extended byedu.cmu.sphinx.linguist.acoustic.Unit

public class Unit
extends java.lang.Object

Represents a unit of speech. Units may represent phones, words or any other suitable unit


Method Summary
 boolean equals(java.lang.Object o)
          Checks to see of an object is equal to this unit
 int getBaseID()
          Gets the base ID for this unit
 Unit getBaseUnit()
          Gets the base unit associated with this HMM
 Context getContext()
          Returns the context for this unit
static Unit[] getEmptyContext(int size)
          Creates and returns an empty context with the given size.
 java.lang.String getName()
          Gets the name for this unit
 int hashCode()
          calculates a hashCode for this unit.
 boolean isContextDependent()
          Determines if this unit is context dependent
static boolean isContextMatch(Unit[] a, Unit[] b)
          Checks to see that there is 100% overlap in the given contexts
 boolean isFiller()
          Determines if this unit is a filler unit
 boolean isPartialMatch(java.lang.String name, Context context)
          Checks to see if the given unit with associated contexts is a partial match for this unit.
 boolean isSilence()
          Determines if this unit is the silence unit
 java.lang.String toString()
          Converts to a string
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

isContextDependent

public boolean isContextDependent()
Determines if this unit is context dependent

Returns:
true if the unit is context dependent

getContext

public Context getContext()
Returns the context for this unit

Returns:
the context for this unit (or null if context independent

isFiller

public boolean isFiller()
Determines if this unit is a filler unit

Returns:
true if the unit is a filler unit

isSilence

public boolean isSilence()
Determines if this unit is the silence unit

Returns:
true if the unit is the silence unit

equals

public boolean equals(java.lang.Object o)
Checks to see of an object is equal to this unit

Parameters:
o - the object to check
Returns:
true if the objects are equal

hashCode

public int hashCode()
calculates a hashCode for this unit. Since we defined an equals for Unit, we must define a hashCode as well

Returns:
the hashcode for this object

toString

public java.lang.String toString()
Converts to a string

Returns:
string version

getName

public java.lang.String getName()
Gets the name for this unit

Returns:
the name for this unit

getBaseID

public int getBaseID()
Gets the base ID for this unit

Returns:
the id

getBaseUnit

public Unit getBaseUnit()
Gets the base unit associated with this HMM

Returns:
the unit associated with this HMM

isPartialMatch

public boolean isPartialMatch(java.lang.String name,
                              Context context)
Checks to see if the given unit with associated contexts is a partial match for this unit. Zero, One or both contexts can be null. A null context matches any context

Parameters:
name - the name of the unit
context - the context to match against
Returns:
true if this unit matches the name and non-null context

getEmptyContext

public static Unit[] getEmptyContext(int size)
Creates and returns an empty context with the given size. The context is padded with SIL filler

Parameters:
size - the size of the context
Returns:
the context

isContextMatch

public static boolean isContextMatch(Unit[] a,
                                     Unit[] b)
Checks to see that there is 100% overlap in the given contexts

Parameters:
a - context to check for a match
b - context to check for a match
Returns:
true if the contexts match