Class JaccardDistance
java.lang.Object
org.apache.commons.text.similarity.JaccardDistance
- All Implemented Interfaces:
EditDistance<Double>
,SimilarityScore<Double>
Measures the Jaccard distance of two sets of character sequence. Jaccard
distance is the dissimilarity between two sets. It is the complementary of
Jaccard similarity.
For further explanation about Jaccard Distance, refer https://en.wikipedia.org/wiki/Jaccard_index
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JaccardSimilarity
We normalize the jaccardSimilarity for the purpose of computing the distance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply
(CharSequence left, CharSequence right) Calculates Jaccard distance of two set character sequence passed as input.
-
Field Details
-
jaccardSimilarity
We normalize the jaccardSimilarity for the purpose of computing the distance.
-
-
Constructor Details
-
JaccardDistance
public JaccardDistance()
-
-
Method Details
-
apply
Calculates Jaccard distance of two set character sequence passed as input. Calculates Jaccard similarity and returns the complement of it.- Specified by:
apply
in interfaceEditDistance<Double>
- Specified by:
apply
in interfaceSimilarityScore<Double>
- Parameters:
left
- first character sequenceright
- second character sequence- Returns:
- index
- Throws:
IllegalArgumentException
- if either String inputnull
-