Package org.apache.lucene.classification
Record Class ClassificationResult<T>
java.lang.Object
java.lang.Record
org.apache.lucene.classification.ClassificationResult<T>
- Record Components:
assignedClass- the classTassigned by aClassifierscore- score the score for the assignedClass as adouble
- All Implemented Interfaces:
Comparable<ClassificationResult<T>>
public record ClassificationResult<T>(T assignedClass, double score)
extends Record
implements Comparable<ClassificationResult<T>>
The result of a call to
Classifier.assignClass(String) holding an assigned class of type
T and a score.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
ConstructorsConstructorDescriptionClassificationResult(T assignedClass, double score) Creates an instance of aClassificationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theassignedClassrecord component.intfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doublescore()Returns the value of thescorerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ClassificationResult
Creates an instance of aClassificationResultrecord class.- Parameters:
assignedClass- the value for theassignedClassrecord componentscore- the value for thescorerecord component
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
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. -
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. -
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 '=='. -
assignedClass
Returns the value of theassignedClassrecord component.- Returns:
- the value of the
assignedClassrecord component
-
score
public double score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-