Class JaccardDistance
java.lang.Object
org.apache.commons.text.similarity.JaccardDistance
- All Implemented Interfaces:
BiFunction<CharSequence,
,CharSequence, Double> EditDistance<Double>
,ObjectSimilarityScore<CharSequence,
,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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(CharSequence left, CharSequence right) Computes the Jaccard distance of two set character sequence passed as input.<E> Double
apply
(SimilarityInput<E> left, SimilarityInput<E> right) Computes the Jaccard distance of two set character sequence passed as input.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Constructor Details
-
JaccardDistance
public JaccardDistance()
-
-
Method Details
-
apply
Computes the Jaccard distance of two set character sequence passed as input. Calculates Jaccard similarity and returns the complement of it.- Specified by:
apply
in interfaceBiFunction<CharSequence,
CharSequence, Double> - Specified by:
apply
in interfaceObjectSimilarityScore<CharSequence,
Double> - Specified by:
apply
in interfaceSimilarityScore<Double>
- Parameters:
left
- first input sequence.right
- second input sequence.- Returns:
- index
- Throws:
IllegalArgumentException
- if either String inputnull
.
-
apply
Computes the Jaccard distance of two set character sequence passed as input. Calculates Jaccard similarity and returns the complement of it.- Type Parameters:
E
- The type of similarity score unit.- Parameters:
left
- first input sequence.right
- second input sequence.- Returns:
- index
- Throws:
IllegalArgumentException
- if either String inputnull
.
-