|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cmu.sphinx.linguist.language.grammar.GrammarNode
public class GrammarNode
Represents a grammar node in a grammar. A grammar is represented as a graph of grammar nodes and
arcs. A grammar node usually represents a word or words, but it can also be a transition point or
simply silence.
| Constructor Summary | |
|---|---|
GrammarNode(int id,
Word[][] alternatives)
Creates a GrammarNode with the given ID, Words. |
|
| Method Summary | |
|---|---|
void |
add(GrammarNode node,
float logProbability)
Adds an arc to the given node |
void |
dump()
Dumps the grammar |
void |
dumpGDL(java.lang.String path)
Dumps the grammar in GDL form |
Word[][] |
getAlternatives()
Retrieves the words associated with this grammar node |
int |
getID()
Returns the ID of this GrammarNode. |
int |
getNumAlternatives()
Gets the number of alternatives |
GrammarArc[] |
getSuccessors()
Retrieves the set of transitions out of this node |
Word |
getWord()
Retrieve the single word associated with this grammar |
Word[] |
getWords(int alternative)
Retrieves the words associated with a specific alternative |
boolean |
isEmpty()
Determines if this grammar node is empty (that is, has no words). |
boolean |
isFinalNode()
Determines if this grammar node is a final node in the grammar |
void |
setFinalNode(boolean isFinal)
Sets the 'final' state of the grammar node. |
java.lang.String |
toString()
Returns the string representation of this object |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GrammarNode(int id,
Word[][] alternatives)
id - the identity of this GrammarNodealternatives - the set of Words in this GrammarNode. This is a two dimensional array, the first index
corresponds to the set of alternative choices, the second index corresponds to a particular
word for the alternative| Method Detail |
|---|
public int getID()
public Word[][] getAlternatives()
public Word[] getWords(int alternative)
alternative - the index of the alternative
public Word getWord()
public int getNumAlternatives()
public boolean isEmpty()
true if the node is empty, otherwise false.public GrammarArc[] getSuccessors()
public boolean isFinalNode()
public void setFinalNode(boolean isFinal)
isFinal - if true the grammar node is a final node.
public void add(GrammarNode node,
float logProbability)
node - the node that this new arc goes tologProbability - the log probability of the transition occuringpublic java.lang.String toString()
toString in class java.lang.Objectpublic void dumpGDL(java.lang.String path)
path - the path to write the gdl file topublic void dump()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||