edu.stanford.nlp.parser.lexparser
Class UnaryRule

java.lang.Object
  extended by edu.stanford.nlp.parser.lexparser.UnaryRule
All Implemented Interfaces:
Rule, java.io.Serializable, java.lang.Comparable<UnaryRule>

public class UnaryRule
extends java.lang.Object
implements Rule, java.lang.Comparable<UnaryRule>, java.io.Serializable

Unary grammar rules (with ints for parent and child).

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

Field Summary
 int child
           
 int parent
           
 float score
          Score should be a log probability
 
Constructor Summary
UnaryRule(int parent, int child)
          The score is set to Float.NaN by default.
UnaryRule(int parent, int child, double score)
           
UnaryRule(java.lang.String s, Index<java.lang.String> index)
          Decode a UnaryRule out of a String representation with help from an Index.
 
Method Summary
 int compareTo(UnaryRule ur)
           
 boolean equals(java.lang.Object o)
          A UnaryRule is equal to another UnaryRule with the same parent and child.
 int hashCode()
           
 int parent()
           
 float score()
           
 java.lang.String toString()
           
 java.lang.String toString(Index<java.lang.String> index)
           
 java.lang.String toStringNoScore(Index<java.lang.String> index)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

public int parent

score

public float score
Score should be a log probability


child

public int child
Constructor Detail

UnaryRule

public UnaryRule(int parent,
                 int child)
The score is set to Float.NaN by default.

Parameters:
parent - Parent state
child - Child state

UnaryRule

public UnaryRule(int parent,
                 int child,
                 double score)

UnaryRule

public UnaryRule(java.lang.String s,
                 Index<java.lang.String> index)
Decode a UnaryRule out of a String representation with help from an Index.

Parameters:
s - The String representation
index - The Index used to convert String to int
Method Detail

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

equals

public boolean equals(java.lang.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 java.lang.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 java.lang.Comparable<UnaryRule>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(Index<java.lang.String> index)

toStringNoScore

public java.lang.String toStringNoScore(Index<java.lang.String> index)


Stanford NLP Group