Class NameFinderDL

java.lang.Object
opennlp.dl.AbstractDL
opennlp.dl.namefinder.NameFinderDL
All Implemented Interfaces:
AutoCloseable, opennlp.tools.namefind.TokenNameFinder

public class NameFinderDL extends AbstractDL implements opennlp.tools.namefind.TokenNameFinder
An implementation of TokenNameFinder that uses ONNX models.
See Also:
  • Field Details

  • Constructor Details

    • NameFinderDL

      public NameFinderDL(File model, File vocabulary, Map<Integer,String> ids2Labels, opennlp.tools.sentdetect.SentenceDetector sentenceDetector) throws IOException, ai.onnxruntime.OrtException
      Instantiates a name finder using ONNX models.
      Parameters:
      model - The ONNX model file.
      vocabulary - The model file's vocabulary file.
      ids2Labels - The mapping of ids to labels.
      sentenceDetector - The SentenceDetector to be used.
      Throws:
      ai.onnxruntime.OrtException - Thrown if the model cannot be loaded.
      IOException - Thrown if errors occurred loading the model or vocabulary.
    • NameFinderDL

      public NameFinderDL(File model, File vocabulary, Map<Integer,String> ids2Labels, InferenceOptions inferenceOptions, opennlp.tools.sentdetect.SentenceDetector sentenceDetector) throws IOException, ai.onnxruntime.OrtException
      Instantiates a name finder using ONNX models.
      Parameters:
      model - The ONNX model file.
      vocabulary - The model file's vocabulary file.
      ids2Labels - The mapping of ids to labels.
      inferenceOptions - InferenceOptions to control the inference.
      sentenceDetector - The SentenceDetector to be used.
      Throws:
      ai.onnxruntime.OrtException - Thrown if the model cannot be loaded.
      IOException - Thrown if errors occurred loading the model or vocabulary.
  • Method Details

    • find

      public opennlp.tools.util.Span[] find(String[] input)
      Specified by:
      find in interface opennlp.tools.namefind.TokenNameFinder
    • clearAdaptiveData

      public void clearAdaptiveData()
      Specified by:
      clearAdaptiveData in interface opennlp.tools.namefind.TokenNameFinder