public class BinaryGrammar extends java.lang.Object implements java.io.Serializable, java.lang.Iterable<BinaryRule>
Constructor and Description |
---|
BinaryGrammar(Index<java.lang.String> stateIndex) |
Modifier and Type | Method and Description |
---|---|
void |
addRule(BinaryRule br) |
boolean |
isSynthetic(int state) |
java.util.Iterator<BinaryRule> |
iterator() |
int |
numRules() |
void |
readData(java.io.BufferedReader in)
Populates data in this BinaryGrammar from the character stream
given by the Reader r.
|
java.util.Iterator<BinaryRule> |
ruleIteratorByLeftChild(int state) |
java.util.Iterator<BinaryRule> |
ruleIteratorByParent(int state) |
java.util.Iterator<BinaryRule> |
ruleIteratorByRightChild(int state) |
java.util.List<BinaryRule> |
ruleListByLeftChild(int state) |
java.util.List<BinaryRule> |
ruleListByParent(int state) |
java.util.List<BinaryRule> |
ruleListByRightChild(int state) |
java.util.List<BinaryRule> |
rules() |
double |
scoreRule(BinaryRule br) |
void |
splitRules()
Populates the "splitRules" accessor lists using the existing rule lists.
|
BinaryRule[] |
splitRulesWithLC(int state) |
BinaryRule[] |
splitRulesWithRC(int state) |
void |
writeData(java.io.Writer w)
Writes out data from this Object to the Writer w.
|
public BinaryGrammar(Index<java.lang.String> stateIndex)
public int numRules()
public java.util.List<BinaryRule> rules()
public boolean isSynthetic(int state)
public void splitRules()
This method must be called before the grammar is used, either after training or deserializing grammar.
public BinaryRule[] splitRulesWithLC(int state)
public BinaryRule[] splitRulesWithRC(int state)
public double scoreRule(BinaryRule br)
public void addRule(BinaryRule br)
public java.util.Iterator<BinaryRule> iterator()
iterator
in interface java.lang.Iterable<BinaryRule>
public java.util.Iterator<BinaryRule> ruleIteratorByParent(int state)
public java.util.Iterator<BinaryRule> ruleIteratorByRightChild(int state)
public java.util.Iterator<BinaryRule> ruleIteratorByLeftChild(int state)
public java.util.List<BinaryRule> ruleListByParent(int state)
public java.util.List<BinaryRule> ruleListByRightChild(int state)
public java.util.List<BinaryRule> ruleListByLeftChild(int state)
public void readData(java.io.BufferedReader in) throws java.io.IOException
in
- Where input is read fromjava.io.IOException
- If format is bungpublic void writeData(java.io.Writer w) throws java.io.IOException
w
- Where output is writtenjava.io.IOException
- If data can't be written