public class CategoryWordTag extends StringLabel implements HasCategory, HasWord, HasTag
CategoryWordTag
object acts as a complex Label
which contains a category, a head word, and a tag.
The category label is the primary value
Modifier and Type | Field and Description |
---|---|
static boolean |
printWordTag
If this is false, the tag and word are never printed in toString()
calls.
|
static boolean |
suppressTerminalDetails
If set to true, when a terminal or preterminal has as its category
something that is also the word or tag value, the latter are
suppressed.
|
protected java.lang.String |
tag |
protected java.lang.String |
word |
Constructor and Description |
---|
CategoryWordTag() |
CategoryWordTag(Label oldLabel)
Creates a new CategoryWordTag label from an existing label.
|
CategoryWordTag(java.lang.String label)
This one argument constructor sets just the value.
|
CategoryWordTag(java.lang.String category,
java.lang.String word,
java.lang.String tag) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
category()
Return the category value of the label (or null if none).
|
static LabelFactory |
factory()
Return a factory for this kind of label
|
LabelFactory |
labelFactory()
Return a factory for this kind of label
(i.e.,
CategoryWordTag ). |
void |
setCategory(java.lang.String category)
Set the category value for the label (if one is stored).
|
void |
setCategoryWordTag(java.lang.String category,
java.lang.String word,
java.lang.String tag) |
void |
setFromString(java.lang.String labelStr)
Set everything by reversing a toString operation.
|
void |
setTag(java.lang.String tag)
Set the tag value for the label (if one is stored).
|
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()
Returns a
String representation of the label. |
java.lang.String |
toString(java.lang.String mode)
Returns a
String representation of the label. |
java.lang.String |
word()
Return the word value of the label (or null if none).
|
beginPosition, endPosition, setBeginPosition, setEndPosition, setValue, value
compareTo, equals, hashCode
protected java.lang.String word
protected java.lang.String tag
public static boolean printWordTag
public static boolean suppressTerminalDetails
public CategoryWordTag()
public CategoryWordTag(java.lang.String label)
label
- the string that will become the category/valuepublic CategoryWordTag(java.lang.String category, java.lang.String word, java.lang.String tag)
public CategoryWordTag(Label oldLabel)
oldLabel
- The label to use as a basis of this Labelpublic java.lang.String category()
HasCategory
category
in interface HasCategory
public void setCategory(java.lang.String category)
HasCategory
setCategory
in interface HasCategory
category
- The category value for the labelpublic java.lang.String word()
HasWord
public void setWord(java.lang.String word)
HasWord
public java.lang.String tag()
HasTag
public void setTag(java.lang.String tag)
HasTag
public void setCategoryWordTag(java.lang.String category, java.lang.String word, java.lang.String tag)
public java.lang.String toString()
String
representation of the label.
This attempts to be somewhat clever in choosing to print or
suppress null components and the details of words or categories
depending on the setting of printWordTag
and
suppressTerminalDetails
.toString
in interface Label
toString
in class StringLabel
public java.lang.String toString(java.lang.String mode)
String
representation of the label.
If the argument String is "full" then all components of the label
are returned, and otherwise the normal toString() is returned.public void setFromString(java.lang.String labelStr)
setFromString
in interface Label
setFromString
in class StringLabel
labelStr
- The str for the labelpublic LabelFactory labelFactory()
CategoryWordTag
).
The factory returned is always the same one (a singleton).labelFactory
in interface Label
labelFactory
in class StringLabel
public static LabelFactory factory()