## edu.stanford.nlp.ling
Interface Label

All Known Implementing Classes:
  CategoryWordTag, Constituent, CoreLabel, CyclicCoreLabel, EmptyTreeLeaf, LabeledConstituent, LabeledScoredTreeNode, LabeledWord, SimpleConstituent, SimpleTree, StringLabel, TaggedWord, Tree, TreeGraphNode, ValueLabel, Word, WordLemmaTag, WordTag

    public interface Label

Something that implements the `Label` interface can act as a constituent, node, or word label with linguistic attributes. A `Label` is required to have a "primary" `String` `value()` (although this may be null). This is referred to as its `value`.

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.

Author:
  Christopher Manning

Method Summary
`LabelFactory` `labelFactory()` Returns a factory that makes labels of the exact same type as this one.
`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

    String value()

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

  Returns:
    the "value" of the label

### setValue

    void setValue(String value)

  Set the value for the label (if one is stored).

  Parameters:
    `value` - - the value for the label

### toString

    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

    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

### labelFactory

    LabelFactory labelFactory()

  Returns a factory that makes labels of the exact same type as this one. May return `null` if no appropriate factory is known.

  Returns:
    the LabelFactory for this kind of label

Stanford NLP Group