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 Details

  • Constructor Details

    • AbstractDL

      public AbstractDL()
  • Method Details

    • loadVocab

      public Map<String,Integer> loadVocab(File vocabFile) throws IOException
      Loads a vocabulary File from disk.
      Parameters:
      vocabFile - The vocabulary file.
      Returns:
      A map of vocabulary words to integer 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.