Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.ling
Class Word

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

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

Direct Known Subclasses:
  LabeledWord, TaggedWord

    public class Word

extends StringLabel
implements HasWord

A `Word` object acts as a Label by containing a String. This class is in essence identical to a `StringLabel`, but it also uses the value to implement the `HasWord` interface.

Author:
  Christopher Manning
See Also:
  Serialized Form

Field Summary
`static Word` | `EMPTY` Word representation of an empty.
`static String` | `EMPTYSTRING` String representation of an empty.

Constructor Summary
`Word()` Construct a new word with a `null` value.
`Word(Label lab)` Creates a new word whose word value is the value of any class that supports the `Label` interface.
`Word(String word)` Construct a new word, with the given value.
`Word(String word, int beginPosition, int endPosition)` Construct a new word, with the given value.

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., `Word`).
`void` | `setWord(String word)` Set the word value for the label (if one is stored).
`String` | `word()` Return the word value of the label (or null if none).

Methods inherited from class edu.stanford.nlp.ling.StringLabel
`beginPosition, endPosition, setBeginPosition, setEndPosition, setFromString, setValue, toString, 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`

Field Detail

### EMPTYSTRING

    public static final String EMPTYSTRING

  String representation of an empty.

  See Also:
    Constant Field Values

### EMPTY

    public static final Word EMPTY

  Word representation of an empty.

Constructor Detail

### Word

    public Word()

  Construct a new word with a `null` value.

### Word

    public Word(String word)

  Construct a new word, with the given value.

  Parameters:
    `word` - String value of the Word

### Word

    public Word(String word,
                int beginPosition,
                int endPosition)

  Construct a new word, with the given value.

  Parameters:
    `word` - String value of the Word

### Word

    public Word(Label lab)

  Creates a new word whose word value is the value of any class that supports the `Label` interface.

  Parameters:
    `lab` - The label to be used as the basis of the new Word

Method Detail

### word

    public String word()

  Description copied from interface: `HasWord`
  Return the word value of the label (or null if none).

  Specified by:
    `word` in interface `HasWord`
  Returns:
    String the word value for the label

### setWord

    public void setWord(String word)

  Description copied from interface: `HasWord`
  Set the word value for the label (if one is stored).

  Specified by:
    `setWord` in interface `HasWord`
  Parameters:
    `word` - The word value for the label

### labelFactory

    public LabelFactory labelFactory()

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

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

### factory

    public static LabelFactory factory()

  Return a factory for this kind of label.

  Returns:
    The label factory

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group