Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.ling
Class CategoryWordTag

    java.lang.Object
      edu.stanford.nlp.ling.ValueLabel
          edu.stanford.nlp.ling.StringLabel
              edu.stanford.nlp.ling.CategoryWordTag

All Implemented Interfaces:
  HasCategory, HasOffset, HasTag, HasWord, Label, Serializable, Comparable<ValueLabel>

    public class CategoryWordTag

extends StringLabel
implements HasCategory, HasWord, HasTag

A `CategoryWordTag` object acts as a complex Label which contains a category, a head word, and a tag. The category label is the primary `value`

Author:
  Christopher Manning
See Also:
  Serialized Form

Field Summary
`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 String` | `tag`
`protected String` | `word`

Constructor Summary
`CategoryWordTag()`
`CategoryWordTag(Label oldLabel)` Creates a new CategoryWordTag label from an existing label.
`CategoryWordTag(String label)` This one argument constructor sets just the value.
`CategoryWordTag(String category, String word, String tag)`

Method Summary
`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(String category)` Set the category value for the label (if one is stored).
`void` | `setCategoryWordTag(String category, String word, String tag)`
`void` | `setFromString(String labelStr)` Set everything by reversing a toString operation.
`void` | `setTag(String tag)` Set the tag value for the label (if one is stored).
`void` | `setWord(String word)` Set the word value for the label (if one is stored).
`String` | `tag()` Return the tag value of the label (or null if none).
`String` | `toString()` Returns a `String` representation of the label.
`String` | `toString(String mode)` Returns a `String` representation of the label.
`String` | `word()` Return the word value of the label (or null if none).

Methods inherited from class edu.stanford.nlp.ling.StringLabel
`beginPosition, endPosition, setBeginPosition, setEndPosition, setValue, value`

Methods inherited from class edu.stanford.nlp.ling.ValueLabel
`compareTo, equals, hashCode`

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

Field Detail

### word

    protected String word

### tag

    protected String tag

### printWordTag

    public static boolean printWordTag

  If this is false, the tag and word are never printed in toString() calls.

### suppressTerminalDetails

    public 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.

Constructor Detail

### CategoryWordTag

    public CategoryWordTag()

### CategoryWordTag

    public CategoryWordTag(String label)

  This one argument constructor sets just the value.

  Parameters:
    `label` - the string that will become the category/value

### CategoryWordTag

    public CategoryWordTag(String category,
                           String word,
                           String tag)

### CategoryWordTag

    public CategoryWordTag(Label oldLabel)

  Creates a new CategoryWordTag label from an existing label. The oldLabel value() -- i.e., category -- is used for the new label. The tag and word are initialized iff the current label implements HasTag and HasWord respectively.

  Parameters:
    `oldLabel` - The label to use as a basis of this Label

Method Detail

### category

    public String category()

  Description copied from interface: `HasCategory`
  Return the category value of the label (or null if none).

  Specified by:
    `category` in interface `HasCategory`
  Returns:
    String the category value for the label

### setCategory

    public void setCategory(String category)

  Description copied from interface: `HasCategory`
  Set the category value for the label (if one is stored).

  Specified by:
    `setCategory` in interface `HasCategory`
  Parameters:
    `category` - The category value for the label

### word

    public String word()

  Description copied from interface: `HasWord`
  Return the word value of the label (or null if none).

  Specified by:
    `word` in interface `HasWord`
  Returns:
    String the word value for the label

### setWord

    public void setWord(String word)

  Description copied from interface: `HasWord`
  Set the word value for the label (if one is stored).

  Specified by:
    `setWord` in interface `HasWord`
  Parameters:
    `word` - The word value for the label

### tag

    public String tag()

  Description copied from interface: `HasTag`
  Return the tag value of the label (or null if none).

  Specified by:
    `tag` in interface `HasTag`
  Returns:
    String the tag value for the label

### setTag

    public void setTag(String tag)

  Description copied from interface: `HasTag`
  Set the tag value for the label (if one is stored).

  Specified by:
    `setTag` in interface `HasTag`
  Parameters:
    `tag` - The tag value for the label

### setCategoryWordTag

    public void setCategoryWordTag(String category,
                                   String word,
                                   String tag)

### toString

    public String toString()

  Returns a `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`.

  Specified by:
    `toString` in interface `Label`
  Overrides:
    `toString` in class `StringLabel`
  Returns:
    The label as a string

### toString

    public String toString(String mode)

  Returns a `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.

  Returns:
    The label as a string

### setFromString

    public void setFromString(String labelStr)

  Set everything by reversing a toString operation. This should be added at some point.

  Specified by:
    `setFromString` in interface `Label`
  Overrides:
    `setFromString` in class `StringLabel`
  Parameters:
    `labelStr` - The str for the label

### labelFactory

    public LabelFactory labelFactory()

  Return a factory for this kind of label (i.e., `CategoryWordTag`). The factory returned is always the same one (a singleton).

  Specified by:
    `labelFactory` in interface `Label`
  Overrides:
    `labelFactory` in class `StringLabel`
  Returns:
    The label factory

### factory

    public static LabelFactory factory()

  Return a factory for this kind of label

  Returns:
    The label factory

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group