public class WordLemmaTag extends java.lang.Object implements Label, java.lang.Comparable<WordLemmaTag>, HasWord, HasTag
value()
method for that
interface corresponds to the word of the WordLemmaTag.
The equality relation for WordLemmaTag is defined as identity of word, lemma and tag.
Constructor and Description |
---|
WordLemmaTag() |
WordLemmaTag(Label word) |
WordLemmaTag(Label word,
Label tag)
Create a new
WordLemmaTag from a Label. |
WordLemmaTag(java.lang.String word) |
WordLemmaTag(java.lang.String word,
java.lang.String tag)
Create a new
WordLemmaTag . |
WordLemmaTag(java.lang.String word,
java.lang.String lemma,
java.lang.String tag)
Create a new
WordLemmaTag . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(WordLemmaTag wordLemmaTag)
Orders first by word, then by lemma, then by tag.
|
boolean |
equals(java.lang.Object o)
Equality is satisfied only if the compared object is a WordLemmaTag
and has String-equal word, lemma and tag fields.
|
int |
hashCode() |
LabelFactory |
labelFactory()
Return a factory for this kind of label
(i.e.,
TaggedWord ). |
java.lang.String |
lemma() |
static void |
main(java.lang.String[] args) |
void |
setFromString(java.lang.String labelStr)
The String is divided according to the divider character (usually, "/").
|
void |
setFromString(java.lang.String labelStr,
java.lang.String divider) |
void |
setLemma(java.lang.String lemma) |
void |
setTag(java.lang.String tag)
Set the tag for the Label.
|
void |
setValue(java.lang.String value)
Set the value for the Label.
|
void |
setWord(java.lang.String word)
Set the word 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) |
java.lang.String |
value()
Return a String representation of just the "main" value of this Label.
|
java.lang.String |
word()
Return the word value of the label (or null if none).
|
public WordLemmaTag(java.lang.String word)
public WordLemmaTag(Label word)
public WordLemmaTag()
public WordLemmaTag(java.lang.String word, java.lang.String tag)
WordLemmaTag
.word
- This word is set as the word of this Labeltag
- The value()
of this Label is set as the
tag of this Labelpublic WordLemmaTag(java.lang.String word, java.lang.String lemma, java.lang.String tag)
WordLemmaTag
.word
- This word is passed to the supertype constructorlemma
- The lemma is set as the lemma of this Labeltag
- The value()
of this Label is set as the
tag of this Labelpublic java.lang.String value()
public java.lang.String word()
HasWord
public void setValue(java.lang.String value)
public void setWord(java.lang.String word)
HasWord
public void setLemma(java.lang.String lemma)
public final void setTag(java.lang.String tag)
public java.lang.String tag()
HasTag
public java.lang.String lemma()
public java.lang.String toString()
public java.lang.String toString(java.lang.String divider)
public void setFromString(java.lang.String labelStr)
null
.
We assume that if only one divider character is found, word and tag are present in
the String, and lemma will be computed.setFromString
in interface Label
labelStr
- The word that will go into the WordLemmaTag
public void setFromString(java.lang.String labelStr, java.lang.String divider)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(WordLemmaTag wordLemmaTag)
compareTo
in interface java.lang.Comparable<WordLemmaTag>
wordLemmaTag
- object to compare tothis
is greater than
obj
, 0 if equal, negative otherwise)public LabelFactory labelFactory()
TaggedWord
).
The factory returned is always the same one (a singleton).labelFactory
in interface Label
public static void main(java.lang.String[] args)