edu.cmu.sphinx.linguist.flat
Class SentenceHMMState

java.lang.Object
  extended byedu.cmu.sphinx.linguist.flat.SentenceHMMState
All Implemented Interfaces:
SearchState, java.io.Serializable
Direct Known Subclasses:
AlternativeState, BranchState, CombineState, GrammarState, HMMStateState, PronunciationState, UnitState, WordState

public abstract class SentenceHMMState
extends java.lang.Object
implements java.io.Serializable, SearchState

Represents a single state in an SentenceHMM

See Also:
Serialized Form

Method Summary
static java.util.Set collectStates(SentenceHMMState start)
          Collect all states starting from the given start state
 void connect(SentenceHMMStateArc arc)
          Connects the arc to this sentence hmm.
 void dumpAll()
          Dumps this SentenceHMMState and all its successors.
 SentenceHMMStateArc findArc(SentenceHMMState state)
          Searches the set of arcs for an arc that points to a state with an identical value
 Word getAssociatedWord()
          Returns the word associated with the particular unit
 Color getColor()
          Gets the color for this node
 java.lang.String getFullName()
          Gets the fullName for this state
 java.lang.Object getLexState()
          Returns the lextree state
 java.lang.String getName()
          Gets the name for this state
 int getNumSuccessors()
          Gets the number of successors
abstract  int getOrder()
          Returns the order of this particular state
 SentenceHMMState getParent()
          Retrieves the parent sate
 java.lang.String getPrettyName()
          Returns a pretty name for this HMM
 java.lang.String getSignature()
          Gets the signature for this state
 SearchStateArc[] getSuccessors()
          Gets a successor to this search state
 java.lang.String getTitle()
          gets the title (fullname + stateNumber) for this state
 java.lang.String getTypeLabel()
          Retrieves a short label describing the type of this state.
 java.lang.String getValueSignature()
          Returns the value signature of this unit
 int getWhich()
          Retrieves the index for this state words
 WordSequence getWordHistory()
          Gets the word history for this state.
 boolean isEmitting()
          Determines if this state is an emitting state
 boolean isFanIn()
          Determines if this state is a fan-in state.
 boolean isFinal()
          Determines if this is a final state
 boolean isProcessed()
          Determines if this state has been 'processed'.
 boolean isSharedState()
          Determines if this state is a shard state
 boolean isUnit()
          Determines if this state is a unit state
 boolean isWordStart()
          Determines if this state marks the beginning of a word
 void resetAllProcessed()
          Reset process flags for this state and all successor states
 void setColor(Color color)
          Sets the color for this node
 void setFanIn(boolean fanIn)
          Sets the fan in state
 void setFinalState(boolean state)
          Sets this is to be final state
 void setProcessed(boolean processed)
          Sets the processed flag for this state
 void setSharedState(boolean shared)
          Sets the shared state flag
 void setWhich(int which)
          Sets the index for this state
 void setWordStart(boolean wordStart)
          Sets the 'wordStart' flag
 java.lang.String toPrettyString()
          Returns a pretty version of the string representation for this object
 java.lang.String toString()
          Returns the string representation of this object
 void validateAll()
          Validates this SentenceHMMState and all successors
static boolean visitStates(edu.cmu.sphinx.linguist.flat.SentenceHMMStateVisitor visitor, SentenceHMMState start, boolean sorted)
          Visit all of the states starting at start with the given vistor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isWordStart

public boolean isWordStart()
Determines if this state marks the beginning of a word

Returns:
true if the state marks the beginning of a word

setWordStart

public void setWordStart(boolean wordStart)
Sets the 'wordStart' flag

Parameters:
wordStart - true if this state marks the beginning of a word.

isSharedState

public boolean isSharedState()
Determines if this state is a shard state

Returns:
true if the state marks the beginning of a word

setSharedState

public void setSharedState(boolean shared)
Sets the shared state flag

Parameters:
shared - true if this state is shared

getAssociatedWord

public Word getAssociatedWord()
Returns the word associated with the particular unit

Returns:
the word associated with this state, or null if there is no word associated with this state.

getTypeLabel

public java.lang.String getTypeLabel()
Retrieves a short label describing the type of this state. Typically, subclasses of SentenceHMMState will implement this method and return a short (5 chars or less) label

Returns:
the short label.

isFanIn

public boolean isFanIn()
Determines if this state is a fan-in state. The search may need to adjust the pruning for states that fan in since they are shared by multiple paths

Returns:
true if the state is a fan in state

setFanIn

public void setFanIn(boolean fanIn)
Sets the fan in state

Parameters:
fanIn - if true its a fan in state

setProcessed

public void setProcessed(boolean processed)
Sets the processed flag for this state

Parameters:
processed - the new setting for the processed flag

isProcessed

public boolean isProcessed()
Determines if this state has been 'processed'. The meaning of 'processed' is not defined here, but is up to the higher levels

Returns:
true if the state has been processed.

resetAllProcessed

public void resetAllProcessed()
Reset process flags for this state and all successor states


getWordHistory

public WordSequence getWordHistory()
Gets the word history for this state.

Specified by:
getWordHistory in interface SearchState
Returns:
the word history.

getNumSuccessors

public int getNumSuccessors()
Gets the number of successors

Returns:
the number of successors

getSuccessors

public SearchStateArc[] getSuccessors()
Gets a successor to this search state

Specified by:
getSuccessors in interface SearchState
Returns:
the set of successors

getLexState

public java.lang.Object getLexState()
Returns the lextree state

Specified by:
getLexState in interface SearchState
Returns:
the lex tree state

connect

public void connect(SentenceHMMStateArc arc)
Connects the arc to this sentence hmm. If the node at the end of the arc is already pointing to some other node as its predecessor, don't change that relationship, since its probably a result of the nodes being reused'

Parameters:
arc - the path to the next state

isEmitting

public boolean isEmitting()
Determines if this state is an emitting state

Specified by:
isEmitting in interface SearchState
Returns:
true if the state is an emitting state

isFinal

public boolean isFinal()
Determines if this is a final state

Specified by:
isFinal in interface SearchState
Returns:
true if this is a final state

setFinalState

public void setFinalState(boolean state)
Sets this is to be final state

Parameters:
state - true if this is a final state

isUnit

public boolean isUnit()
Determines if this state is a unit state

Returns:
true if the state is a unit state.

dumpAll

public void dumpAll()
Dumps this SentenceHMMState and all its successors. Just for debugging.


validateAll

public void validateAll()
Validates this SentenceHMMState and all successors


getName

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

Returns:
the name

getPrettyName

public java.lang.String getPrettyName()
Returns a pretty name for this HMM

Returns:
a pretty name

toString

public java.lang.String toString()
Returns the string representation of this object


toPrettyString

public java.lang.String toPrettyString()
Description copied from interface: SearchState
Returns a pretty version of the string representation for this object

Specified by:
toPrettyString in interface SearchState
Returns:
a pretty string

getFullName

public java.lang.String getFullName()
Gets the fullName for this state

Returns:
the full name for this state

getSignature

public java.lang.String getSignature()
Gets the signature for this state

Specified by:
getSignature in interface SearchState
Returns:
the signature

getTitle

public java.lang.String getTitle()
gets the title (fullname + stateNumber) for this state

Returns:
the title

getWhich

public int getWhich()
Retrieves the index for this state words

Returns:
the index

setWhich

public void setWhich(int which)
Sets the index for this state

Parameters:
which - the index for this state

getParent

public SentenceHMMState getParent()
Retrieves the parent sate

Returns:
the parent state (or null if this state does not have a parent state).

findArc

public SentenceHMMStateArc findArc(SentenceHMMState state)
Searches the set of arcs for an arc that points to a state with an identical value

Parameters:
state - the state to search for
Returns:
the arc or null if none could be found.

getValueSignature

public java.lang.String getValueSignature()
Returns the value signature of this unit

Returns:
the value signature

visitStates

public static boolean visitStates(edu.cmu.sphinx.linguist.flat.SentenceHMMStateVisitor visitor,
                                  SentenceHMMState start,
                                  boolean sorted)
Visit all of the states starting at start with the given vistor

Parameters:
visitor - the state visitor
start - the place to start the search
sorted - if true, states are sorted before visited
Returns:
true if the visiting was terminated before all nodes were visited

setColor

public void setColor(Color color)
Sets the color for this node

Parameters:
color - the color of this node

getColor

public Color getColor()
Gets the color for this node

Returns:
the color of this node

collectStates

public static java.util.Set collectStates(SentenceHMMState start)
Collect all states starting from the given start state

Parameters:
start - the state to start the search from
Returns:
the set of collected state

getOrder

public abstract int getOrder()
Returns the order of this particular state

Specified by:
getOrder in interface SearchState
Returns:
the state order for this state