Class JaccardSimilarity
- java.lang.Object
-
- org.apache.commons.text.similarity.JaccardSimilarity
-
- All Implemented Interfaces:
SimilarityScore<java.lang.Double>
public class JaccardSimilarity extends java.lang.Object implements SimilarityScore<java.lang.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
Constructors Constructor Description JaccardSimilarity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Double
apply(java.lang.CharSequence left, java.lang.CharSequence right)
Calculates Jaccard Similarity of two set character sequence passed as input.
-
-
-
Method Detail
-
apply
public java.lang.Double apply(java.lang.CharSequence left, java.lang.CharSequence right)
Calculates Jaccard Similarity of two set character sequence passed as input.- Specified by:
apply
in interfaceSimilarityScore<java.lang.Double>
- Parameters:
left
- first character sequenceright
- second character sequence- Returns:
- index
- Throws:
java.lang.IllegalArgumentException
- if either String inputnull
-
-