Klasse SentenceVectorsDL

java.lang.Object
opennlp.dl.AbstractDL
opennlp.dl.vectors.SentenceVectorsDL
Alle implementierten Schnittstellen:
AutoCloseable

public class SentenceVectorsDL extends AbstractDL
Facilitates the generation of sentence vectors using a sentence-transformers model converted to ONNX.
  • Konstruktordetails

    • SentenceVectorsDL

      public SentenceVectorsDL(File model, File vocabulary) throws ai.onnxruntime.OrtException, IOException
      Instantiates a sentence detector using ONNX models.
      Parameter:
      model - The file name of a sentence vectors ONNX model.
      vocabulary - The file name of the vocabulary file for the model.
      Löst aus:
      ai.onnxruntime.OrtException - Thrown if the model cannot be loaded.
      IOException - Thrown if errors occurred loading the model or vocabulary.
  • Methodendetails

    • getVectors

      public float[] getVectors(String sentence) throws ai.onnxruntime.OrtException
      Generates vectors given a sentence.
      Parameter:
      sentence - The input sentence.
      Löst aus:
      ai.onnxruntime.OrtException - Thrown if an error occurs during inference.