edu.stanford.nlp.parser.lexparser
Class UnaryGrammar

java.lang.Object
  extended by 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

Field Summary
protected  Map coreRules
           
 
Constructor Summary
UnaryGrammar(int numStates)
           
UnaryGrammar(int numStates, String stateSpace)
           
 
Method Summary
 void addRule(UnaryRule ur)
           
 Iterator closedRuleIterator()
           
 Iterator closedRuleIteratorByChild(int state)
           
 Iterator closedRuleIteratorByParent(int state)
           
 UnaryRule[] closedRulesByChild(int state)
           
 UnaryRule[] closedRulesByParent(int state)
           
 List getBestPath(int parent, int child)
           
 Iterator iterator()
           
 int numClosedRules()
           
 int numRules()
           
 void purgeRules()
           
 void readData(BufferedReader in)
          Populates data in this UnaryGrammar from the character stream given by the Reader r.
 Iterator ruleIterator()
           
 Iterator ruleIteratorByChild(int state)
           
 Iterator ruleIteratorByParent(int state)
           
 List rules()
           
 List rulesByChild(int state)
           
 List rulesByParent(int state)
           
 List[] rulesWithParent()
           
 double scoreRule(UnaryRule ur)
           
 void writeData(Writer w)
          Writes out data from this Object to the Writer w.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coreRules

protected Map coreRules
Constructor Detail

UnaryGrammar

public UnaryGrammar(int numStates)

UnaryGrammar

public UnaryGrammar(int numStates,
                    String stateSpace)
Method Detail

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