Class OnnxTextEmbedderProvider

java.lang.Object
opennlp.dl.vectors.OnnxTextEmbedderProvider
All Implemented Interfaces:
opennlp.tools.embeddings.TextEmbedderProvider, opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>

public final class OnnxTextEmbedderProvider extends Object implements opennlp.tools.embeddings.TextEmbedderProvider
Provides a SentenceVectorsDL under the name "onnx". It supports a spec whose location is a local file named *.onnx, in any letter case, and whose only options are "vocabulary", "lowerCase", "pooling", "normalize", "maxLength" and "padding". The option values are checked by create(ProviderSpec), which also initializes the ONNX Runtime.
Since:
3.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The option that lower-cases the text, true by default or false.
    static final String
    The option that sets the maximum number of tokens per input, at least 2, 512 by default.
    static final String
    The name of this provider.
    static final String
    The option that scales vectors to unit length, true by default or false.
    static final String
    The option that selects the PaddingStrategy: auto by default, exact_length, longest or max_length, in any letter case.
    static final String
    The option that selects the Pooling, mean by default or cls.
    static final String
    The required option that names the vocabulary file, resolved against the directory of the model if it is relative.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    opennlp.tools.embeddings.TextEmbedder
    create(opennlp.tools.util.ext.ProviderSpec spec)
     
    boolean
    Checks that the ONNX Runtime classes are present without initializing the runtime.
     
    boolean
    supports(opennlp.tools.util.ext.ProviderSpec spec)
     

    Methods inherited from class Object

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

    Methods inherited from interface opennlp.tools.util.ext.Provider

    priority
  • Field Details

    • NAME

      public static final String NAME
      The name of this provider.
      See Also:
    • VOCABULARY_OPTION

      public static final String VOCABULARY_OPTION
      The required option that names the vocabulary file, resolved against the directory of the model if it is relative.
      See Also:
    • LOWER_CASE_OPTION

      public static final String LOWER_CASE_OPTION
      The option that lower-cases the text, true by default or false.
      See Also:
    • POOLING_OPTION

      public static final String POOLING_OPTION
      The option that selects the Pooling, mean by default or cls.
      See Also:
    • NORMALIZE_OPTION

      public static final String NORMALIZE_OPTION
      The option that scales vectors to unit length, true by default or false.
      See Also:
    • MAX_LENGTH_OPTION

      public static final String MAX_LENGTH_OPTION
      The option that sets the maximum number of tokens per input, at least 2, 512 by default.
      See Also:
    • PADDING_OPTION

      public static final String PADDING_OPTION
      The option that selects the PaddingStrategy: auto by default, exact_length, longest or max_length, in any letter case.
      See Also:
  • Constructor Details

    • OnnxTextEmbedderProvider

      public OnnxTextEmbedderProvider()
  • Method Details

    • name

      public String name()
      Specified by:
      name in interface opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
    • isAvailable

      public boolean isAvailable()
      Checks that the ONNX Runtime classes are present without initializing the runtime.
      Specified by:
      isAvailable in interface opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
    • supports

      public boolean supports(opennlp.tools.util.ext.ProviderSpec spec)
      Specified by:
      supports in interface opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
    • create

      public opennlp.tools.embeddings.TextEmbedder create(opennlp.tools.util.ext.ProviderSpec spec) throws IOException
      Specified by:
      create in interface opennlp.tools.util.ext.Provider<opennlp.tools.embeddings.TextEmbedder>
      Throws:
      IOException