public final class JaroWinkler extends Object implements StringMetric, StringDistance
similarity(a,b) = jaro-winkler(a,b)
distance(a,b) = 1 - similarity(a,b)
Can be configured with a prefix adjustment scale, max prefix length and boost threshold.
This class is immutable and thread-safe.
Jaro| Constructor and Description |
|---|
JaroWinkler()
Constructs a new JaroWinkler metric.
|
JaroWinkler(float boostThreshold,
float prefixScale,
int maxPrefixLength)
Constructs a new JaroWinkler metric.
|
| Modifier and Type | Method and Description |
|---|---|
float |
compare(String a,
String b)
Measures the similarity between strings a and b.
|
static JaroWinkler |
createWithBoostThreshold()
Constructs a new JaroWinkler metric with Winklers boost threshold of 0.7.
|
float |
distance(String a,
String b)
Measures the distance between string a and b.
|
String |
toString() |
public JaroWinkler()
public JaroWinkler(float boostThreshold,
float prefixScale,
int maxPrefixLength)
boostThreshold - minimum jaro score for which the score is boostedprefixScale - scale at which a common prefix adds a bonusmaxPrefixLength - cutoff at which a longer common prefix does not improve the
scorepublic static JaroWinkler createWithBoostThreshold()
public float distance(String a, String b)
StringDistance0.0 indicates that a and
b are similar.distance in interface Distance<String>distance in interface StringDistancea - string a to compareb - string b to comparepublic float compare(String a, String b)
StringMetriccompare in interface Metric<String>compare in interface StringMetrica - string a to compareb - string b to compareCopyright © 2014–2016. All rights reserved.