@Immutable public class SorensenDice extends ShingleBased implements NormalizedStringDistance, NormalizedStringSimilarity
Constructor and Description |
---|
SorensenDice()
Sorensen-Dice coefficient, aka Sørensen index, Dice's coefficient or
Czekanowski's binary (non-quantitative) index.
|
SorensenDice(int k)
Sorensen-Dice coefficient, aka Sørensen index, Dice's coefficient or
Czekanowski's binary (non-quantitative) index.
|
Modifier and Type | Method and Description |
---|---|
double |
distance(String s1,
String s2)
Returns 1 - similarity.
|
double |
similarity(String s1,
String s2)
Similarity is computed as 2 * |A inter B| / (|A| + |B|).
|
getK, getProfile
public SorensenDice(int k)
k
- public SorensenDice()
public final double similarity(String s1, String s2)
similarity
in interface StringSimilarity
s1
- The first string to compare.s2
- The second string to compare.NullPointerException
- if s1 or s2 is null.public final double distance(String s1, String s2)
distance
in interface StringDistance
s1
- The first string to compare.s2
- The second string to compare.NullPointerException
- if s1 or s2 is null.Copyright © 2017. All rights reserved.