edu.stanford.nlp.parser.lexparser
Class UnaryRule
java.lang.Object
edu.stanford.nlp.parser.lexparser.UnaryRule
- All Implemented Interfaces:
- Rule, Serializable, Comparable<UnaryRule>
public class UnaryRule
- extends Object
- implements Rule, Comparable<UnaryRule>, Serializable
Unary grammar rules (with ints for parent and child).
- Author:
- Dan Klein, Christopher Manning
- See Also:
- Serialized Form
Constructor Summary |
UnaryRule(int parent,
int child)
The score is set to Float.NaN by default. |
UnaryRule(int parent,
int child,
double score)
|
UnaryRule(String s,
Index<String> index)
Decode a UnaryRule out of a String representation with help from
an Index. |
parent
public int parent
score
public float score
child
public int child
UnaryRule
public UnaryRule(int parent,
int child)
- The score is set to Float.NaN by default.
- Parameters:
parent
- Parent statechild
- Child state
UnaryRule
public UnaryRule(int parent,
int child,
double score)
UnaryRule
public UnaryRule(String s,
Index<String> index)
- Decode a UnaryRule out of a String representation with help from
an Index.
- Parameters:
s
- The String representationindex
- The Index used to convert String to int
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)
- A UnaryRule is equal to another UnaryRule with the same parent and child.
The score is not included in the equality computation.
- Overrides:
equals
in class Object
- Parameters:
o
- Object to be compared with
- Returns:
- Whether the object is equal to this
compareTo
public int compareTo(UnaryRule ur)
- Specified by:
compareTo
in interface Comparable<UnaryRule>
toString
public String toString()
- Overrides:
toString
in class Object
toString
public String toString(Index<String> index)
toStringNoScore
public String toStringNoScore(Index<String> index)
Stanford NLP Group