edu.stanford.nlp.parser.lexparser
Class UnaryGrammar
java.lang.Object
edu.stanford.nlp.parser.lexparser.UnaryGrammar
- All Implemented Interfaces:
- Serializable, Iterable<UnaryRule>
public class UnaryGrammar
- extends Object
- implements Serializable, Iterable<UnaryRule>
Maintains efficient indexing of binary grammar rules.
- Author:
- Dan Klein
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
coreRules
protected Map coreRules
UnaryGrammar
public UnaryGrammar(int numStates)
UnaryGrammar
public UnaryGrammar(int numStates,
String stateSpace)
numClosedRules
public int numClosedRules()
closedRuleIterator
public Iterator closedRuleIterator()
numRules
public int numRules()
iterator
public Iterator iterator()
- Specified by:
iterator
in interface Iterable<UnaryRule>
ruleIterator
public Iterator ruleIterator()
rules
public List rules()
purgeRules
public void purgeRules()
getBestPath
public List getBestPath(int parent,
int child)
scoreRule
public double scoreRule(UnaryRule ur)
addRule
public void addRule(UnaryRule ur)
closedRulesByParent
public UnaryRule[] closedRulesByParent(int state)
closedRulesByChild
public UnaryRule[] closedRulesByChild(int state)
closedRuleIteratorByParent
public Iterator closedRuleIteratorByParent(int state)
closedRuleIteratorByChild
public Iterator closedRuleIteratorByChild(int state)
ruleIteratorByParent
public Iterator ruleIteratorByParent(int state)
ruleIteratorByChild
public Iterator ruleIteratorByChild(int state)
rulesByParent
public List rulesByParent(int state)
rulesByChild
public List rulesByChild(int state)
rulesWithParent
public List[] rulesWithParent()
readData
public void readData(BufferedReader in)
throws IOException
- Populates data in this UnaryGrammar from the character stream
given by the Reader r.
- Throws:
IOException
writeData
public void writeData(Writer w)
throws IOException
- Writes out data from this Object to the Writer w.
- Throws:
IOException
Stanford NLP Group