edu.stanford.nlp.parser.lexparser
Class BinaryRule
java.lang.Object
edu.stanford.nlp.parser.lexparser.BinaryRule
- All Implemented Interfaces:
- Rule, Serializable, Comparable<BinaryRule>
public class BinaryRule
- extends Object
- implements Rule, Comparable<BinaryRule>, Serializable
Binary rules (ints for parent, left and right children)
- Author:
- Dan Klein, Christopher Manning
- See Also:
- Serialized Form
Constructor Summary |
BinaryRule(int parent,
int leftChild,
int rightChild)
Create a new BinaryRule with the parent and children coded as ints. |
BinaryRule(int parent,
int leftChild,
int rightChild,
double score)
|
BinaryRule(String s,
Index<String> index)
Creates a BinaryRule from String s, assuming it was created using toString(). |
parent
public int parent
score
public float score
leftChild
public int leftChild
rightChild
public int rightChild
BinaryRule
public BinaryRule(int parent,
int leftChild,
int rightChild)
- Create a new BinaryRule with the parent and children coded as ints.
Score defaults to Float.NaN.
- Parameters:
parent
- The parent intleftChild
- The left child intrightChild
- The right child int
BinaryRule
public BinaryRule(int parent,
int leftChild,
int rightChild,
double score)
BinaryRule
public BinaryRule(String s,
Index<String> index)
- Creates a BinaryRule from String s, assuming it was created using toString().
- Parameters:
s
- A String in which the binary rule is represented as parent,
left-child, right-child, score, with the items quoted as neededindex
- Index used to convert String names to ints
score
public float score()
- Specified by:
score
in interface Rule
parent
public int parent()
- Specified by:
parent
in interface Rule
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
toString
public String toString(Index<String> index)
toStringNoScore
public String toStringNoScore(Index<String> index)
compareTo
public int compareTo(BinaryRule br)
- Specified by:
compareTo
in interface Comparable<BinaryRule>
Stanford NLP Group