edu.stanford.nlp.trees
Interface Label

All Superinterfaces:
Comparable
All Known Implementing Classes:
AbstractLabel, Constituent

public interface Label
extends Comparable

Something that implements the Label interface can act as a constituent, node, or word label with linguistic attributes. A Label is expected to have a "primary" String value (although this may be null). This is referred to as its value. Equality of Labels is standardly defined by the String equality of its value. Subclasses may override this behavior, but only so long as they are careful to observe the contract for equality defined for Object. In particular, it must by symmetric.


Method Summary
 int compareTo(Object obj)
          Implementation of comparison for Label.
 LabelFactory labelFactory()
          Returns a factory that makes this kind of label.
 void setFromString(String labelStr)
          Set the contents of this label to this String representing the complete contents of the label.
 void setValue(String value)
          Set the value for the label (if one is stored).
 String toString()
          Return a String representation of the label.
 String value()
          Return a String representation of just the "main" value of this label.
 

Method Detail

value

public String value()
Return a String representation of just the "main" value of this label.

Returns:
the "value" of the label

setValue

public void setValue(String value)
Set the value for the label (if one is stored).

Parameters:
value - - the value for the label

toString

public String toString()
Return a String representation of the label. For a multipart label, this will return all parts. The toString() method causes a label to spill its guts. It should always return an empty string rather than null if there is no value.

Overrides:
toString in class Object
Returns:
a text representation of the full label contents

setFromString

public void setFromString(String labelStr)
Set the contents of this label to this String representing the complete contents of the label. A class implementing label may throw an UnsupportedOperationException for this method (only). Typically, this method would do some appropriate decoding of the string in a way that sets multiple fields in an inverse of the toString() method.

Parameters:
labelStr - the String that translates into the content of the label

compareTo

public int compareTo(Object obj)
Implementation of comparison for Label. By default this orders by value's string lexicographic ordering.

Specified by:
compareTo in interface Comparable
Parameters:
obj - object to compare to
Returns:
result (positive if this is greater than obj, 0 if equal, negative otherwise)

labelFactory

public LabelFactory labelFactory()
Returns a factory that makes this kind of label. May return null if no appropriate factory is known

Returns:
the LabelFactory for this kind of label


Stanford NLP Group