Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.9
-
Windows 10
AdoptOpenJDK 11
Description
The following two code snippets give the same output:
// checking similarity JaroWinklerSimilarity jws = new JaroWinklerSimilarity(); System.out.println("SIMILARITY: " + jws.apply("foo", "foo") + " " + jws.apply("foo", "bar")); // SIMILARITY: 1.0 0.0
// checking distance JaroWinklerDistance jwd = new JaroWinklerDistance(); System.out.println("DISTANCE: " + jwd.apply("foo", "foo") + " " + jwd.apply("foo", "bar")); // DISTANCE: 1.0 0.0
I would expect the distance to be 1 - similarity, but as you can see distance and similarity return the same values.
An easy fix would be to use the commented lines in JaroWinklerDistance.java:
// JaroWinklerSimilarity similarity = new JaroWinklerSimilarity(); // return 1 - similarity.apply(left, right);
and maybe make similarity be a final property/variable.
Attachments
Issue Links
- duplicates
-
TEXT-206 JaroWinklerDistance returning its compliment, ie 1 - distance
- Resolved