Record Class SentenceVectorsOptions
java.lang.Object
java.lang.Record
opennlp.dl.vectors.SentenceVectorsOptions
- Record Components:
pooling- How token vectors are pooled. Not used for a model with asentence_embeddingoutput. Must not benull.normalize-trueto scale every vector to unit length.maxLength- The maximum number of tokens per input, including the classification and separator tokens. Longer input is truncated. Must be at least2.padding- The padding strategy. Must not benull.PaddingStrategy.AUTOselects the device and model default:SentenceVectorsDL.DEFAULT_GPU_PADDINGon a GPU for a token output if the vocabulary has a padding token,SentenceVectorsDL.DEFAULT_CPU_PADDINGotherwise. An explicit padded strategy requires a padding token in the vocabulary.
public record SentenceVectorsOptions(Pooling pooling, boolean normalize, int maxLength, PaddingStrategy padding)
extends Record
Pooling, normalization, truncation and padding settings for
SentenceVectorsDL.- Since:
- 3.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates settings for mean pooling, unit length scaling, a maximum of 512 tokens and the device and model padding default.SentenceVectorsOptions(Pooling pooling, boolean normalize, int maxLength, PaddingStrategy padding) Creates vector settings after validating the pooling mode, maximum length and padding strategy. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxLengthrecord component.booleanReturns the value of thenormalizerecord component.padding()Returns the value of thepaddingrecord component.pooling()Returns the value of thepoolingrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SentenceVectorsOptions
public SentenceVectorsOptions(Pooling pooling, boolean normalize, int maxLength, PaddingStrategy padding) Creates vector settings after validating the pooling mode, maximum length and padding strategy.- Throws:
IllegalArgumentException- Thrown ifpoolingorpaddingisnull, ormaxLengthis less than2.
-
SentenceVectorsOptions
public SentenceVectorsOptions()Creates settings for mean pooling, unit length scaling, a maximum of 512 tokens and the device and model padding default.
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
pooling
-
normalize
-
maxLength
-
padding
-