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 Exception
      Closes this resource, relinquishing any underlying resources.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception - If it failed to close.