public class GrammarNode
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
GrammarNode(int id,
boolean isFinal)
Creates a GrammarNode with the given ID and silence or final attributes.
|
|
GrammarNode(int id,
Word[][] alternatives)
Creates a GrammarNode with the given ID, Words.
|
Modifier and Type | Method and Description |
---|---|
void |
add(GrammarNode node,
float logProbability)
Adds an arc to the given node
|
void |
dump()
Dumps the grammar
|
void |
dumpDot(java.lang.String path) |
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
|
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 alternativeprotected GrammarNode(int id, boolean isFinal)
id
- the identity of this GrammarNodeisFinal
- if true this is a final nodepublic int getID()
public Word[][] getAlternatives()
public Word[] getWords(int alternative)
alternative
- the index of the alternativepublic 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.Object
public void dumpGDL(java.lang.String path)
path
- the path to write the gdl file topublic void dump()
public void dumpDot(java.lang.String path)