edu.stanford.nlp.trees
Class Word

java.lang.Object
  |
  +--edu.stanford.nlp.trees.AbstractLabel
        |
        +--edu.stanford.nlp.trees.StringLabel
              |
              +--edu.stanford.nlp.trees.Word
All Implemented Interfaces:
Comparable, HasWord, Label
Direct Known Subclasses:
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.


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.
 
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.trees.StringLabel
setFromString, setValue, value
 
Methods inherited from class edu.stanford.nlp.trees.AbstractLabel
compareTo, equals, hashCode, toString
 
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(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


Stanford NLP Group