public class JaroWinkler extends Object implements StringMetric
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.
|
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 compare(String a, String b)
StringMetric
compare
in interface Metric<String>
compare
in interface StringMetric
a
- string a to compareb
- string b to compareCopyright © 2014–2018. All rights reserved.