You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Glen Edmonds (Jira)" <ji...@apache.org> on 2021/05/11 23:31:00 UTC
[jira] [Comment Edited] (TEXT-206) JaroWinklerDistance returning
its compliment, ie 1 - distance
[ https://issues.apache.org/jira/browse/TEXT-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342915#comment-17342915 ]
Glen Edmonds edited comment on TEXT-206 at 5/11/21, 11:30 PM:
--------------------------------------------------------------
[~kinow] I didn't check the impl, but the unit tests look correct.
I suspect someone used a JaroWinkler _similarity_ spec without thinking it though.
I'm surprised this bug remained undetected since the start of the project - 4 years.
Consider adding a JaroWinklerSimilarity class with the old impl in case projects are relying on the broken impl and they need a landing pad.
FYI, my work around:
{noformat}
JaroWinklerDistance jaroWinklerDistance = new JaroWinklerDistance() {
@Override
public Double apply(CharSequence left, CharSequence right) {
return 1 - super.apply(left, right); // TODO: BUG FIX!
}
};
{noformat}
was (Author: bohemian):
[~kinow] I didn't check the impl, but the unit tests look correct.
I suspect someone used a JaroWinkler _similarity_ spec without thinking it though.
I'm surprised this bug remained undetected since the start of the project - 4 years.
Consider adding a JaroWinklerSimilarity class with the old impl in case projects are relying on the broken impl and they need a landing pad.
FYI, my work around:
{{ JaroWinklerDistance jaroWinklerDistance = new JaroWinklerDistance() {
@Override
public Double apply(CharSequence left, CharSequence right) {
return 1 - super.apply(left, right); // TODO: BUG FIX!
}
};}}
> JaroWinklerDistance returning its compliment, ie 1 - distance
> -------------------------------------------------------------
>
> Key: TEXT-206
> URL: https://issues.apache.org/jira/browse/TEXT-206
> Project: Commons Text
> Issue Type: Bug
> Affects Versions: 1.9
> Environment: Mac OS, jdk-15.0.1.jdk
> Reporter: Glen Edmonds
> Priority: Critical
> Labels: distance
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> This class is returning {{1 - distance}}, but its contract is to return {{distance}}.
> These are some examples from in the javadoc of the {{apply()}} method:
> {{distance.apply("foo", "foo") = 0.0}}
> {{distance.apply("hello", "hallo") = 0.12}}
> {{distance.apply("fly", "ant") = 1.0}}
> but execution of the method produces the compliment: 1.0, 0.88 and 0.0
> Test code:
> {{System.out.println(new JaroWinklerDistance().apply("foo", "foo"));}}
> {{System.out.println(new JaroWinklerDistance().apply("hello", "hallo"));}}
> {{System.out.println(new JaroWinklerDistance().apply("fly", "ant"));}}
> Actual output:
> {{1.0}}
> {{0.88}}
> {{0.0}}
> Expected output:
> {{0.0}}
> {{0.12}}
> {{1.0}}
> Java version: jdk-15.0.1.jdk
--
This message was sent by Atlassian Jira
(v8.3.4#803005)