Package opennlp.dl

# Class AbstractDL

java.lang.Object
opennlp.dl.AbstractDL

All Implemented Interfaces:
  `AutoCloseable`

Direct Known Subclasses:
  `DocumentCategorizerDL`, `NameFinderDL`, `SentenceVectorsDL`

public abstract class AbstractDL extends Object implements AutoCloseable
Base class for OpenNLP deep-learning classes using ONNX Runtime.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ATTENTION_MASK`
  `static final String`
  `INPUT_IDS`
  `static final String`
  `TOKEN_TYPE_IDS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDL()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes this resource, relinquishing any underlying resources.
  `Map<String,Integer>`
  `loadVocab(File vocabFile)`
  Loads a vocabulary `File` from disk.

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

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INPUT_IDS

    public static final String INPUT_IDS
    See Also:
      - Constant Field Values

  - ### ATTENTION_MASK

    public static final String ATTENTION_MASK
    See Also:
      - Constant Field Values

  - ### TOKEN_TYPE_IDS

    public static final String TOKEN_TYPE_IDS
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AbstractDL

    public AbstractDL()

- ## Method Details

  - ### loadVocab

    public Map<String,Integer> loadVocab(File vocabFile) throws IOException
    Loads a vocabulary `File` from disk. Supports both plain text files (one token per line) and JSON files mapping tokens to integer IDs.
    Parameters:
      `vocabFile` - The vocabulary file.
    Returns:
      A map of vocabulary words to IDs.
    Throws:
      `IOException` - Thrown if the vocabulary file cannot be opened or read.

  - ### close

    public void close() throws ai.onnxruntime.OrtException, IllegalStateException
    Closes this resource, relinquishing any underlying resources.
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `ai.onnxruntime.OrtException` - Thrown if it failed to close Ort resources.
      `IllegalStateException` - Thrown if the underlying resources were already closed.