Record Class AbstractDL.InferenceSettings

java.lang.Object
java.lang.Record
opennlp.dl.AbstractDL.InferenceSettings
Record Components:
includeAttentionMask - Whether the "attention_mask" input is passed to the model.
includeTokenTypeIds - Whether the "token_type_ids" input is passed to the model.
documentSplitSize - The maximum number of whitespace tokens per chunk.
splitOverlapSize - The number of whitespace tokens shared by consecutive chunks.
normalizeWhitespace - Whether Unicode whitespace is folded to ASCII spaces.
normalizeDashes - Whether Unicode dashes are folded to the ASCII hyphen.
Enclosing class:
AbstractDL

@Internal(since="3.0.0") protected static record AbstractDL.InferenceSettings(boolean includeAttentionMask, boolean includeTokenTypeIds, int documentSplitSize, int splitOverlapSize, boolean normalizeWhitespace, boolean normalizeDashes) extends Record
The InferenceOptions values a component reads during inference, copied once at construction so later changes to the options object do not affect a shared instance.
  • Constructor Details

    • InferenceSettings

      protected InferenceSettings(boolean includeAttentionMask, boolean includeTokenTypeIds, int documentSplitSize, int splitOverlapSize, boolean normalizeWhitespace, boolean normalizeDashes)
      Creates an instance of a InferenceSettings record class.
      Parameters:
      includeAttentionMask - the value for the includeAttentionMask record component
      includeTokenTypeIds - the value for the includeTokenTypeIds record component
      documentSplitSize - the value for the documentSplitSize record component
      splitOverlapSize - the value for the splitOverlapSize record component
      normalizeWhitespace - the value for the normalizeWhitespace record component
      normalizeDashes - the value for the normalizeDashes record component
  • Method Details

    • from

      public static AbstractDL.InferenceSettings from(InferenceOptions options)
      Copies the inference values of options.
      Parameters:
      options - The options to copy. Must not be null.
      Returns:
      The settings.
      Throws:
      IllegalArgumentException - Thrown if options is null.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • includeAttentionMask

      public boolean includeAttentionMask()
      Returns the value of the includeAttentionMask record component.
      Returns:
      the value of the includeAttentionMask record component
    • includeTokenTypeIds

      public boolean includeTokenTypeIds()
      Returns the value of the includeTokenTypeIds record component.
      Returns:
      the value of the includeTokenTypeIds record component
    • documentSplitSize

      public int documentSplitSize()
      Returns the value of the documentSplitSize record component.
      Returns:
      the value of the documentSplitSize record component
    • splitOverlapSize

      public int splitOverlapSize()
      Returns the value of the splitOverlapSize record component.
      Returns:
      the value of the splitOverlapSize record component
    • normalizeWhitespace

      public boolean normalizeWhitespace()
      Returns the value of the normalizeWhitespace record component.
      Returns:
      the value of the normalizeWhitespace record component
    • normalizeDashes

      public boolean normalizeDashes()
      Returns the value of the normalizeDashes record component.
      Returns:
      the value of the normalizeDashes record component