## edu.stanford.nlp.ling
Class TaggedWordFactory

    java.lang.Object
      edu.stanford.nlp.ling.TaggedWordFactory

All Implemented Interfaces:
  LabelFactory

    public class TaggedWordFactory

extends Object
implements LabelFactory

A `TaggedWordFactory` acts as a factory for creating objects of class `TaggedWord`.

Author:
  Christopher Manning

Field Summary
`static int` `TAG_LABEL`

Constructor Summary
`TaggedWordFactory()` Create a new `TaggedWordFactory`.
`TaggedWordFactory(char divider)` Create a new `TaggedWordFactory`.

Method Summary
`Label` `newLabel(Label oldLabel)` Create a new `TaggedWord Label`, where the label is formed from the `Label` object passed in.
`Label` `newLabel(String labelStr)` Make a new label with this `String` as the value (word).
`Label` `newLabel(String labelStr, int options)` Make a new label with this `String` as a value component.
`Label` `newLabelFromString(String word)` Create a new word, where the label is formed from the `String` passed in.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TAG_LABEL

    public static final int TAG_LABEL

See Also:
  Constant Field Values

Constructor Detail

### TaggedWordFactory

    public TaggedWordFactory()

  Create a new `TaggedWordFactory`. The divider will be taken as '/'.

### TaggedWordFactory

    public TaggedWordFactory(char divider)

  Create a new `TaggedWordFactory`.

  Parameters:
    `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.

Method Detail

### newLabel

    public Label newLabel(String labelStr)

  Make a new label with this `String` as the value (word). Any other fields of the label would normally be null.

  Specified by:
    `newLabel` in interface `LabelFactory`
  Parameters:
    `labelStr` - The String that will be used for value
  Returns:
    The new TaggedWord (tag will be `null`)

### newLabel

    public Label newLabel(String labelStr,
                          int options)

  Make a new label with this `String` as a value component. Any other fields of the label would normally be null.

  Specified by:
    `newLabel` in interface `LabelFactory`
  Parameters:
    `labelStr` - The String that will be used for value
    `options` - what to make (use labelStr as word or tag)
  Returns:
    The new TaggedWord (tag or word will be `null`)

### newLabelFromString

    public Label newLabelFromString(String word)

  Create a new word, where the label is formed from the `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`.

  Specified by:
    `newLabelFromString` in interface `LabelFactory`
  Parameters:
    `word` - The word that will go into the `Word`
  Returns:
    The new TaggedWord

### newLabel

    public Label newLabel(Label oldLabel)

  Create a new `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`.

  Specified by:
    `newLabel` in interface `LabelFactory`
  Parameters:
    `oldLabel` - The Label that the new label is being created from
  Returns:
    a new label of a particular type

Stanford NLP Group