public interface Label
Labelinterface can act as a constituent, node, or word label with linguistic attributes. A
Labelis required to have a "primary"
value()(although this may be null). This is referred to as its
Implementations of Label split into two groups with respect to equality. Classes that extend ValueLabel define equality solely in terms of String equality of its value (secondary facets may be present but are ignored for purposes of equality), and have equals and compareTo defined across all subclasses of ValueLabel. This behavior should not be changed. Other classes that implement Label define equality only with their own type and require all fields of the type to be equal.
A subclass that extends another Label class should override
the definition of
labelFactory(), since the contract for
this method is that it should return a factory for labels of the
exact same object type.
|Modifier and Type||Method and Description|
Returns a factory that makes labels of the exact same type as this one.
Set the contents of this label to this
Set the value for the label (if one is stored).
Return a String representation of the label.
Return a String representation of just the "main" value of this label.
void setValue(String value)
value- - the value for the label
toString()method causes a label to spill its guts. It should always return an empty string rather than
nullif there is no value.
void setFromString(String labelStr)
Stringrepresenting the complete contents of the label. A class implementing label may throw an
UnsupportedOperationExceptionfor 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
labelStr- the String that translates into the content of the label
nullif no appropriate factory is known.
© 2002-2013 Stanford NLP Group