Package opennlp.dl.vectors
Class SentenceVectorsDL
java.lang.Object
opennlp.dl.AbstractDL
opennlp.dl.vectors.SentenceVectorsDL
Facilitates the generation of sentence vectors using
a sentence-transformers model converted to ONNX.
-
Field Summary
Fields inherited from class opennlp.dl.AbstractDL
ATTENTION_MASK, INPUT_IDS, TOKEN_TYPE_IDS -
Constructor Summary
ConstructorsConstructorDescriptionSentenceVectorsDL(File model, File vocabulary) Instantiates asentence detectorusing ONNX models. -
Method Summary
Modifier and TypeMethodDescriptionfloat[]getVectors(String sentence) Generates vectors given a sentence.Methods inherited from class opennlp.dl.AbstractDL
loadVocab
-
Constructor Details
-
SentenceVectorsDL
public SentenceVectorsDL(File model, File vocabulary) throws ai.onnxruntime.OrtException, IOException Instantiates asentence detectorusing ONNX models.- Parameters:
model- The file name of a sentence vectors ONNX model.vocabulary- The file name of the vocabulary file for the model.- Throws:
ai.onnxruntime.OrtException- Thrown if themodelcannot be loaded.IOException- Thrown if errors occurred loading themodelorvocabulary.
-
-
Method Details
-
getVectors
Generates vectors given a sentence.- Parameters:
sentence- The input sentence.- Throws:
ai.onnxruntime.OrtException- Thrown if an error occurs during inference.
-