public class WordLemmaTagFactory extends java.lang.Object implements LabelFactory
WordLemmaTagFactory
acts as a factory for creating
objects of class WordLemmaTag
.Modifier and Type | Field and Description |
---|---|
static int |
LEMMA_LABEL |
static int |
TAG_LABEL |
Constructor and Description |
---|
WordLemmaTagFactory()
Create a new
WordLemmaTagFactory . |
WordLemmaTagFactory(char divider)
Create a new
WordLemmaTagFactory . |
Modifier and Type | Method and Description |
---|---|
Label |
newLabel(Label oldLabel)
Create a new
WordLemmaTag 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 labelStr)
Create a new word, where the label is formed from
the
String passed in. |
public static final int LEMMA_LABEL
public static final int TAG_LABEL
public WordLemmaTagFactory()
WordLemmaTagFactory
.
The divider will be taken as '/'.public WordLemmaTagFactory(char divider)
WordLemmaTagFactory
.divider
- This character will be used in calls to the one
argument version of newLabel()
, to divide
word from lemma and tag.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, lemma or tag)null
)public Label newLabelFromString(java.lang.String labelStr)
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 lemma and tag
are null
.
We assume that if only one divider character is found, word and tag are presents in
the String, and lemma will be computed.newLabelFromString
in interface LabelFactory
labelStr
- The word that will go into the Word
public Label newLabel(Label oldLabel)
WordLemmaTag 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