public class LabeledWord extends Word
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 StringConstructor and Description |
---|
LabeledWord()
Create a new
TaggedWord . |
LabeledWord(Label word,
Label tag) |
LabeledWord(java.lang.String word)
Create a new
TaggedWord . |
LabeledWord(java.lang.String word,
Label 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 |
setTag(Label tag) |
Label |
tag() |
java.lang.String |
toString()
Return a string representation of the label.
|
java.lang.String |
toString(java.lang.String divider) |
beginPosition, endPosition, setBeginPosition, setEndPosition, setFromString, setValue, value
compareTo, equals, hashCode
public LabeledWord()
TaggedWord
.
It will have null
for its content fields.public LabeledWord(java.lang.String word)
TaggedWord
.word
- The word, which will have a null
tagpublic LabeledWord(java.lang.String word, Label tag)
TaggedWord
.word
- The wordtag
- The tagpublic Label tag()
public void setTag(Label tag)
public java.lang.String toString()
ValueLabel
value()
if it is non-null
,
and the empty string otherwise.toString
in interface Label
toString
in class StringLabel
public java.lang.String toString(java.lang.String divider)
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()