Package opennlp.dl.vectors

# Class SentenceVectorsDL

java.lang.Object
opennlp.dl.AbstractDL
opennlp.dl.vectors.SentenceVectorsDL

All Implemented Interfaces:
  `AutoCloseable`

public class SentenceVectorsDL extends AbstractDL
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

  Constructors
  Constructor
  Description
  `SentenceVectorsDL(File model, File vocabulary)`
  Instantiates a `sentence detector` using ONNX models.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `float[]`
  `getVectors(String sentence)`
  Generates vectors given a sentence.

  ### Methods inherited from class opennlp.dl.AbstractDL

  `close, loadVocab`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SentenceVectorsDL

    public SentenceVectorsDL(File model, File vocabulary) throws ai.onnxruntime.OrtException, IOException
    Instantiates a `sentence detector` using 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 the `model` cannot be loaded.
      `IOException` - Thrown if errors occurred loading the `model` or `vocabulary`.

- ## Method Details

  - ### getVectors

    public float[] getVectors(String sentence) throws ai.onnxruntime.OrtException
    Generates vectors given a sentence.
    Parameters:
      `sentence` - The input sentence.
    Throws:
      `ai.onnxruntime.OrtException` - Thrown if an error occurs during inference.