MascToken (Apache OpenNLP :: Core :: Formats 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.formats.masc, class: MascToken

Package opennlp.tools.formats.masc

# Class MascToken

java.lang.Object
opennlp.tools.util.Span
opennlp.tools.formats.masc.MascToken

All Implemented Interfaces:
  `Serializable`, `Comparable<opennlp.tools.util.Span>`

public class MascToken extends opennlp.tools.util.Span
A specialized `Span` to express tokens in `documents`.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MascToken(int s, int e, int pennId, String pos, String base, MascWord[] quarks)`
  Initializes a `MascToken` which may combine multiple quarks.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getBase()`
  `String`
  `getPos()`
  `MascWord[]`
  `getQuarks()`
  `int`
  `getTokenId()`

  ### Methods inherited from class opennlp.tools.util.Span

  `compareTo, contains, contains, crosses, equals, getCoveredText, getEnd, getProb, getStart, getType, hashCode, intersects, length, spansToStrings, spansToStrings, startsWith, toString, trim`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### MascToken

    public MascToken(int s, int e, int pennId, String pos, String base, MascWord[] quarks)
    Initializes a `MascToken` which may combine multiple quarks.
    Parameters:
      `s` - The start of the token in the corpus file. Must be equal to or greater than `0`.
      `e` - The end of the token in the corpus file. Must be equal to or greater than `0` and be greater than `s`.
      `pennId` - The ID of the token as assigned by the Penn stand-off annotation.
      `pos` - The POS-tag.
      `base` - The base form.
      `quarks` - The `array of Quarks` contained in the token.
    Throws:
      `IllegalArgumentException` - Thrown if one of the parameters are invalid.

- ## Method Details

  - ### getTokenId

    public int getTokenId()
    Returns:
      Retrieves the ID of the token.

  - ### getBase

    public String getBase()
    Returns:
      Retrieves the base form.

  - ### getPos

    public String getPos()
    Returns:
      Retrieves the POS tag.

  - ### getQuarks

    public MascWord[] getQuarks()
    Returns:
      Retrieves quarks of the token.