public class TaggedWord extends Word implements HasTag
TaggedWord object contains a word and its tag.
The value() of a TaggedWord is the Word. The tag
is secondary.EMPTY, EMPTY_STRING| Constructor and Description |
|---|
TaggedWord()
Create a new
TaggedWord. |
TaggedWord(Label oldLabel)
Create a new
TaggedWord. |
TaggedWord(Label word,
Label tag)
Create a new
TaggedWord. |
TaggedWord(java.lang.String word)
Create a new
TaggedWord. |
TaggedWord(java.lang.String word,
java.lang.String tag)
Create a new
TaggedWord. |
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.String taggedWord)
Sets a TaggedWord from decoding
the
String passed in. |
void |
setFromString(java.lang.String taggedWord,
java.lang.String divider) |
void |
setTag(java.lang.String tag)
Set the tag value for the label (if one is stored).
|
java.lang.String |
tag()
Return the tag value of the label (or null if none).
|
java.lang.String |
toString()
Return a string representation of the label.
|
java.lang.String |
toString(java.lang.String divider) |
beginPosition, endPosition, setBeginPosition, setEndPosition, setValue, valuecompareTo, equals, hashCodepublic TaggedWord()
TaggedWord.
It will have null for its content fields.public TaggedWord(java.lang.String word)
TaggedWord.word - The word, which will have a null tagpublic TaggedWord(java.lang.String word,
java.lang.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 java.lang.String tag()
HasTagpublic void setTag(java.lang.String tag)
HasTagpublic java.lang.String toString()
ValueLabelvalue() if it is non-null,
and the empty string otherwise.toString in interface LabeltoString in class StringLabelpublic java.lang.String toString(java.lang.String divider)
public void setFromString(java.lang.String taggedWord)
String passed in. The String is divided according
to the divider character (usually, "/"). 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 LabelsetFromString in class StringLabeltaggedWord - The word that will go into the Wordpublic void setFromString(java.lang.String taggedWord,
java.lang.String divider)
public LabelFactory labelFactory()
TaggedWord).
The factory returned is always the same one (a singleton).labelFactory in interface LabellabelFactory in class Wordpublic static LabelFactory factory()