Class JaccardSimilarity
java.lang.Object
org.apache.commons.text.similarity.JaccardSimilarity
- All Implemented Interfaces:
SimilarityScore<Double>
Measures the Jaccard similarity (aka Jaccard index) of two sets of character
sequence. Jaccard similarity is the size of the intersection divided by the
size of the union of the two sets.
For further explanation about Jaccard Similarity, refer https://en.wikipedia.org/wiki/Jaccard_index
- Since:
- 1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(CharSequence left, CharSequence right) Calculates Jaccard Similarity of two set character sequence passed as input.
-
Constructor Details
-
JaccardSimilarity
public JaccardSimilarity()
-
-
Method Details
-
apply
Calculates Jaccard Similarity of two set character sequence passed as input.- Specified by:
apply
in interfaceSimilarityScore<Double>
- Parameters:
left
- first character sequenceright
- second character sequence- Returns:
- index
- Throws:
IllegalArgumentException
- if either String inputnull
-