|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.trees.AbstractLabel | +--edu.stanford.nlp.trees.StringLabel | +--edu.stanford.nlp.trees.Word | +--edu.stanford.nlp.trees.TaggedWord
A TaggedWord
object contains a word and its tag.
The value()
of a TaggedWord is the Word. The tag
is secondary.
Field Summary |
Fields inherited from class edu.stanford.nlp.trees.Word |
EMPTY, EMPTYSTRING |
Constructor Summary | |
TaggedWord()
Create a new TaggedWord . |
|
TaggedWord(Label oldLabel)
Create a new TaggedWord . |
|
TaggedWord(Label word,
Label tag)
Create a new TaggedWord . |
|
TaggedWord(String word)
Create a new TaggedWord . |
|
TaggedWord(String word,
String 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 |
setFromString(String taggedWord)
Sets a TaggedWord from decoding the String passed in. |
void |
setTag(String tag)
Set the tag value for the label (if one is stored). |
String |
tag()
Return the tag value of the label (or null if none). |
String |
toString()
Return a string representation of the label. |
Methods inherited from class edu.stanford.nlp.trees.Word |
setWord, word |
Methods inherited from class edu.stanford.nlp.trees.StringLabel |
setValue, value |
Methods inherited from class edu.stanford.nlp.trees.AbstractLabel |
compareTo, equals, hashCode |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TaggedWord()
TaggedWord
.
It will have null
for its content fields.
public TaggedWord(String word)
TaggedWord
.
word
- The word, which will have a null
tagpublic TaggedWord(String word, String tag)
TaggedWord
.
word
- The wordtag
- The tagpublic TaggedWord(Label oldLabel)
TaggedWord
.
oldLabel
- A Label. If it implements the HasWord and/or
HasTag interface, then the corresponding value will be setpublic TaggedWord(Label word, Label tag)
TaggedWord
.
word
- This word is passed to the supertype constructortag
- The value()
of this label is set as the
tag of this LabelMethod Detail |
public String tag()
HasTag
tag
in interface HasTag
public void setTag(String tag)
HasTag
setTag
in interface HasTag
tag
- The tag value for the labelpublic String toString()
AbstractLabel
value()
if it is non-null
,
and the empty string otherwise.
toString
in interface Label
toString
in class AbstractLabel
public void setFromString(String taggedWord)
String
passed in. The String is divided according
to the divider character ("/"). We assume that we can always just
divide on the rightmost divider character, rather than trying to
parse up escape sequences. If the divider character isn't found
in the word, then the whole string becomes the word, and the tag
is null
.
setFromString
in interface Label
setFromString
in class StringLabel
taggedWord
- The word that will go into the Word
public LabelFactory labelFactory()
TaggedWord
).
The factory returned is always the same one (a singleton).
labelFactory
in interface Label
labelFactory
in class Word
public static LabelFactory factory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |