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 Summary
ConstructorsModifierConstructorDescriptionprotectedInferenceSettings(boolean includeAttentionMask, boolean includeTokenTypeIds, int documentSplitSize, int splitOverlapSize, boolean normalizeWhitespace, boolean normalizeDashes) Creates an instance of aInferenceSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedocumentSplitSizerecord component.final booleanIndicates whether some other object is "equal to" this one.static AbstractDL.InferenceSettingsfrom(InferenceOptions options) Copies the inference values ofoptions.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theincludeAttentionMaskrecord component.booleanReturns the value of theincludeTokenTypeIdsrecord component.booleanReturns the value of thenormalizeDashesrecord component.booleanReturns the value of thenormalizeWhitespacerecord component.intReturns the value of thesplitOverlapSizerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
InferenceSettings
protected InferenceSettings(boolean includeAttentionMask, boolean includeTokenTypeIds, int documentSplitSize, int splitOverlapSize, boolean normalizeWhitespace, boolean normalizeDashes) Creates an instance of aInferenceSettingsrecord class.- Parameters:
includeAttentionMask- the value for theincludeAttentionMaskrecord componentincludeTokenTypeIds- the value for theincludeTokenTypeIdsrecord componentdocumentSplitSize- the value for thedocumentSplitSizerecord componentsplitOverlapSize- the value for thesplitOverlapSizerecord componentnormalizeWhitespace- the value for thenormalizeWhitespacerecord componentnormalizeDashes- the value for thenormalizeDashesrecord component
-
-
Method Details
-
from
Copies the inference values ofoptions.- Parameters:
options- The options to copy. Must not benull.- Returns:
- The settings.
- Throws:
IllegalArgumentException- Thrown ifoptionsisnull.
-
toString
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
includeAttentionMask
public boolean includeAttentionMask()Returns the value of theincludeAttentionMaskrecord component.- Returns:
- the value of the
includeAttentionMaskrecord component
-
includeTokenTypeIds
public boolean includeTokenTypeIds()Returns the value of theincludeTokenTypeIdsrecord component.- Returns:
- the value of the
includeTokenTypeIdsrecord component
-
documentSplitSize
public int documentSplitSize()Returns the value of thedocumentSplitSizerecord component.- Returns:
- the value of the
documentSplitSizerecord component
-
splitOverlapSize
public int splitOverlapSize()Returns the value of thesplitOverlapSizerecord component.- Returns:
- the value of the
splitOverlapSizerecord component
-
normalizeWhitespace
public boolean normalizeWhitespace()Returns the value of thenormalizeWhitespacerecord component.- Returns:
- the value of the
normalizeWhitespacerecord component
-
normalizeDashes
public boolean normalizeDashes()Returns the value of thenormalizeDashesrecord component.- Returns:
- the value of the
normalizeDashesrecord component
-