public class WordTagFactory extends java.lang.Object implements LabelFactory
WordTagFactory
acts as a factory for creating
objects of class WordTag
. Note that
WordTag
is a replacement for (now deprecated)
TaggedWord
, which has a less stringent equality
condition.Constructor and Description |
---|
WordTagFactory()
Create a new
WordTagFactory . |
WordTagFactory(char divider)
Create a new
WordTagFactory . |
Modifier and Type | Method and Description |
---|---|
Label |
newLabel(Label oldLabel)
Create a new
WordTag Label , where the label is
formed from
the Label object passed in. |
Label |
newLabel(java.lang.String labelStr)
Make a new label with this
String as the value (word). |
Label |
newLabel(java.lang.String labelStr,
int options)
Make a new label with this
String as a value component. |
Label |
newLabelFromString(java.lang.String word)
Create a new word, where the label is formed from
the
String passed in. |
public WordTagFactory()
WordTagFactory
.
The divider will be taken as '/'.public WordTagFactory(char divider)
WordTagFactory
.divider
- This character will be used in calls to the one
argument version of newLabel()
, to divide
the word from the tag. Stuff after the last instance of this
character will become the tag, and stuff before it will
become the label.public Label newLabel(java.lang.String labelStr)
String
as the value (word).
Any other fields of the label would normally be null.newLabel
in interface LabelFactory
labelStr
- The String that will be used for valuenull
)public Label newLabel(java.lang.String labelStr, int options)
String
as a value component.
Any other fields of the label would normally be null.newLabel
in interface LabelFactory
labelStr
- The String that will be used for valueoptions
- what to make (use labelStr as word or tag)null
)public Label newLabelFromString(java.lang.String word)
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
.newLabelFromString
in interface LabelFactory
word
- The word that will go into the Word
public Label newLabel(Label oldLabel)
WordTag Label
, where the label is
formed from
the Label
object passed in. Depending on what fields
each label has, other things will be null
.newLabel
in interface LabelFactory
oldLabel
- The Label that the new label is being created from