Tokens (Apache OpenNLP :: Core :: ML :: Deep Learning 3.0.0-M4 API)
Description: declaration: package: opennlp.dl, record: Tokens

Package opennlp.dl

# Record Class Tokens

java.lang.Object
java.lang.Record
opennlp.dl.Tokens

Record Components:
  `tokens` - The tokens themselves.
  `ids` - The token IDs as retrieved from the vocabulary.
  `mask` - The token mask. (Typically all 1.)
  `types` - The token types. (Typically all 1.)

public record Tokens(String[] tokens, long[] ids, long[] mask, long[] types) extends Record
Holds the tokens for input to an ONNX model.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Tokens(String[] tokens, long[] ids, long[] mask, long[] types)`
  Creates an instance of a `Tokens` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `long[]`
  `ids()`
  Returns the value of the `ids` record component.
  `long[]`
  `mask()`
  Returns the value of the `mask` record component.
  `String[]`
  `tokens()`
  Returns the value of the `tokens` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.
  `long[]`
  `types()`
  Returns the value of the `types` record component.

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

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

- ## Constructor Details

  - ### Tokens

    public Tokens(String[] tokens, long[] ids, long[] mask, long[] types)
    Creates an instance of a `Tokens` record class.
    Parameters:
      `tokens` - the value for the `tokens` record component
      `ids` - the value for the `ids` record component
      `mask` - the value for the `mask` record component
      `types` - the value for the `types` record component

- ## Method Details

  - ### toString

    public final String toString()
    Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### hashCode

    public final int hashCode()
    Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with `Objects::equals(Object,Object)`.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### tokens

    public String[] tokens()
    Returns the value of the `tokens` record component.
    Returns:
      the value of the `tokens` record component

  - ### ids

    public long[] ids()
    Returns the value of the `ids` record component.
    Returns:
      the value of the `ids` record component

  - ### mask

    public long[] mask()
    Returns the value of the `mask` record component.
    Returns:
      the value of the `mask` record component

  - ### types

    public long[] types()
    Returns the value of the `types` record component.
    Returns:
      the value of the `types` record component