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 StringLabel

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

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

Direct Known Subclasses:
  CategoryWordTag, Word

    public class StringLabel

extends ValueLabel
implements HasOffset

A `StringLabel` object acts as a Label by containing a single String, which it sets or returns in response to requests. The hashCode() and compareTo() methods for this class assume that this string value is non-null. equals() is correctly implemented

Author:
  Christopher Manning
See Also:
  Serialized Form

Constructor Summary
`StringLabel()` Create a new `StringLabel` with a null content (i.e., str).
`StringLabel(Label label)` Create a new `StringLabel` with the `value()` of another label as its label.
`StringLabel(String str)` Create a new `StringLabel` with the given content.
`StringLabel(String str, int beginPosition, int endPosition)` Create a new `StringLabel` with the given content.

Method Summary
`int` | `beginPosition()` Return the beginning character offset of the label (or -1 if none).
`int` | `endPosition()` Return the ending character offset of the label (or -1 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., `StringLabel`).
`void` | `setBeginPosition(int beginPosition)` Set the beginning character offset for the label.
`void` | `setEndPosition(int endPosition)` Set the ending character offset of the label (or -1 if none).
`void` | `setFromString(String str)` Set the label from a String.
`void` | `setValue(String value)` Set the value for the label.
`String` | `toString()` Return a string representation of the label.
`String` | `value()` Return the word value of the label (or null if none).

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`

Constructor Detail

### StringLabel

    public StringLabel()

  Create a new `StringLabel` with a null content (i.e., str).

### StringLabel

    public StringLabel(String str)

  Create a new `StringLabel` with the given content.

  Parameters:
    `str` - The new label's content

### StringLabel

    public StringLabel(String str,
                       int beginPosition,
                       int endPosition)

  Create a new `StringLabel` with the given content.

  Parameters:
    `str` - The new label's content
    `beginPosition` - Start offset in original text
    `endPosition` - End offset in original text

### StringLabel

    public StringLabel(Label label)

  Create a new `StringLabel` with the `value()` of another label as its label.

  Parameters:
    `label` - The other label

Method Detail

### value

    public String value()

  Return the word value of the label (or null if none).

  Specified by:
    `value` in interface `Label`
  Overrides:
    `value` in class `ValueLabel`
  Returns:
    String the word value for the label

### setValue

    public void setValue(String value)

  Set the value for the label.

  Specified by:
    `setValue` in interface `Label`
  Overrides:
    `setValue` in class `ValueLabel`
  Parameters:
    `value` - The value for the label

### setFromString

    public void setFromString(String str)

  Set the label from a String.

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

### toString

    public String toString()

  Description copied from class: `ValueLabel`
  Return a string representation of the label. This will just be the `value()` if it is non-`null`, and the empty string otherwise.

  Specified by:
    `toString` in interface `Label`
  Overrides:
    `toString` in class `ValueLabel`
  Returns:
    The string representation

### labelFactory

    public LabelFactory labelFactory()

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

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

### factory

    public static LabelFactory factory()

  Return a factory for this kind of label.

  Returns:
    The label factory

### beginPosition

    public int beginPosition()

  Description copied from interface: `HasOffset`
  Return the beginning character offset of the label (or -1 if none).

  Specified by:
    `beginPosition` in interface `HasOffset`
  Returns:
    the beginning position for the label

### endPosition

    public int endPosition()

  Description copied from interface: `HasOffset`
  Return the ending character offset of the label (or -1 if none).

  Specified by:
    `endPosition` in interface `HasOffset`
  Returns:
    the end position for the label

### setBeginPosition

    public void setBeginPosition(int beginPosition)

  Description copied from interface: `HasOffset`
  Set the beginning character offset for the label. Setting this key to "-1" can be used to indicate no valid value.

  Specified by:
    `setBeginPosition` in interface `HasOffset`
  Parameters:
    `beginPosition` - The beginning position

### setEndPosition

    public void setEndPosition(int endPosition)

  Description copied from interface: `HasOffset`
  Set the ending character offset of the label (or -1 if none).

  Specified by:
    `setEndPosition` in interface `HasOffset`
  Parameters:
    `endPosition` - The end character offset for the label

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