## edu.stanford.nlp.ling
Class LabeledWord

    java.lang.Object
      edu.stanford.nlp.ling.ValueLabel
          edu.stanford.nlp.ling.StringLabel
              edu.stanford.nlp.ling.Word
                  edu.stanford.nlp.ling.LabeledWord

All Implemented Interfaces:
  HasOffset, HasWord, Label, Serializable, Comparable<ValueLabel>

    public class LabeledWord

extends Word

A `LabeledWord` object contains a word and its tag. The `value()` of a TaggedWord is the Word. The tag is, and is a Label instead of a String

See Also:
  Serialized Form

Field Summary

Fields inherited from class edu.stanford.nlp.ling.Word
`EMPTY, EMPTYSTRING`

Constructor Summary
`LabeledWord()` Create a new `TaggedWord`.
`LabeledWord(Label word, Label tag)`
`LabeledWord(String word)` Create a new `TaggedWord`.
`LabeledWord(String word, Label tag)` Create a new `TaggedWord`.

Method Summary
`static LabelFactory` `factory()` Return a factory for this kind of label.
`LabelFactory` `labelFactory()` Return a factory for this kind of label (i.e., `TaggedWord`).
`void` `setTag(Label tag)`
`Label` `tag()`
`String` `toString()` Return a string representation of the label.
`String` `toString(String divider)`

Methods inherited from class edu.stanford.nlp.ling.Word
`setWord, word`

Methods inherited from class edu.stanford.nlp.ling.StringLabel
`beginPosition, endPosition, setBeginPosition, setEndPosition, setFromString, setValue, value`

Methods inherited from class edu.stanford.nlp.ling.ValueLabel
`compareTo, equals, hashCode`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LabeledWord

    public LabeledWord()

  Create a new `TaggedWord`. It will have `null` for its content fields.

### LabeledWord

    public LabeledWord(String word)

  Create a new `TaggedWord`.

  Parameters:
    `word` - The word, which will have a `null` tag

### LabeledWord

    public LabeledWord(String word,
                       Label tag)

  Create a new `TaggedWord`.

  Parameters:
    `word` - The word
    `tag` - The tag

### LabeledWord

    public LabeledWord(Label word,
                       Label tag)

Method Detail

### tag

    public Label tag()

### setTag

    public void setTag(Label tag)

### toString

    public String toString()

  Description copied from class: `ValueLabel`
  Return a string representation of the label. This will just be the `value()` if it is non-`null`, and the empty string otherwise.

  Specified by:
    `toString` in interface `Label`
  Overrides:
    `toString` in class `StringLabel`
  Returns:
    The string representation

### toString

    public String toString(String divider)

### labelFactory

    public LabelFactory labelFactory()

  Return a factory for this kind of label (i.e., `TaggedWord`). The factory returned is always the same one (a singleton).

  Specified by:
    `labelFactory` in interface `Label`
  Overrides:
    `labelFactory` in class `Word`
  Returns:
    The label factory

### factory

    public static LabelFactory factory()

  Return a factory for this kind of label.

  Returns:
    The label factory

Stanford NLP Group