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 unary grammar rules.

Author:
Dan Klein, Christopher Manning
See Also:
Serialized Form

Constructor Summary
UnaryGrammar(int numStates)
           
UnaryGrammar(int numStates, String stateSpace)
           
 
Method Summary
 void addRule(UnaryRule ur)
           
 Iterator<UnaryRule> closedRuleIterator()
           
 Iterator<UnaryRule> closedRuleIteratorByChild(int state)
           
 Iterator<UnaryRule> closedRuleIteratorByParent(int state)
           
 UnaryRule[] closedRulesByChild(int state)
           
 UnaryRule[] closedRulesByParent(int state)
           
 List<Integer> getBestPath(int parent, int child)
           
 Iterator<UnaryRule> iterator()
           
 int numClosedRules()
           
 int numRules()
           
 void purgeRules()
          Remove A -> A UnaryRules from bestRulesUnderMax.
 void readData(BufferedReader in)
          Populates data in this UnaryGrammar from the character stream given by the Reader in.
 Iterator<UnaryRule> ruleIterator()
           
 Iterator<UnaryRule> ruleIteratorByChild(int state)
           
 Iterator<UnaryRule> ruleIteratorByParent(int state)
           
 List<UnaryRule> rules()
           
 List<UnaryRule> rulesByChild(int state)
           
 List<UnaryRule> rulesByParent(int state)
           
 List[] rulesWithParent()
           
 double scoreRule(UnaryRule ur)
           
 String toString()
           
 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, wait, wait, wait
 

Constructor Detail

UnaryGrammar

public UnaryGrammar(int numStates)

UnaryGrammar

public UnaryGrammar(int numStates,
                    String stateSpace)
Method Detail

numClosedRules

public int numClosedRules()

closedRuleIterator

public Iterator<UnaryRule> closedRuleIterator()

numRules

public int numRules()

iterator

public Iterator<UnaryRule> iterator()
Specified by:
iterator in interface Iterable<UnaryRule>

ruleIterator

public Iterator<UnaryRule> ruleIterator()

rules

public List<UnaryRule> rules()

purgeRules

public void purgeRules()
Remove A -> A UnaryRules from bestRulesUnderMax.


getBestPath

public List<Integer> 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<UnaryRule> closedRuleIteratorByParent(int state)

closedRuleIteratorByChild

public Iterator<UnaryRule> closedRuleIteratorByChild(int state)

ruleIteratorByParent

public Iterator<UnaryRule> ruleIteratorByParent(int state)

ruleIteratorByChild

public Iterator<UnaryRule> ruleIteratorByChild(int state)

rulesByParent

public List<UnaryRule> rulesByParent(int state)

rulesByChild

public List<UnaryRule> 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 in.

Throws:
IOException

writeData

public void writeData(Writer w)
               throws IOException
Writes out data from this Object to the Writer w.

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Stanford NLP Group