public class TaggedWordFactory extends java.lang.Object implements LabelFactory
TaggedWordFactory acts as a factory for creating objects of
class TaggedWord.| Modifier and Type | Field and Description |
|---|---|
static int |
TAG_LABEL |
| Constructor and Description |
|---|
TaggedWordFactory()
Create a new
TaggedWordFactory. |
TaggedWordFactory(char divider)
Create a new
TaggedWordFactory. |
| Modifier and Type | Method and Description |
|---|---|
Label |
newLabel(Label oldLabel)
Create a new
TaggedWord 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 static final int TAG_LABEL
public TaggedWordFactory()
TaggedWordFactory.
The divider will be taken as '/'.public TaggedWordFactory(char divider)
TaggedWordFactory.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 LabelFactorylabelStr - 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 LabelFactorylabelStr - 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 LabelFactoryword - The word that will go into the Wordpublic Label newLabel(Label oldLabel)
TaggedWord 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 LabelFactoryoldLabel - The Label that the new label is being created from