java-string-similarity icon indicating copy to clipboard operation
java-string-similarity copied to clipboard

Jaro winkler similarity on Empty strings

Open santhosh6328 opened this issue 2 years ago • 3 comments
trafficstars

I am using jaro wrinkler similarity to check similarities between names. In one of the use case, i found this issue. s1 = "SOME NAME" - s2 = "" -> similarity = 1 Why is the output "1". shouldn't "1" be for exact matches ? please help

version details : java-string-similarity -> 2.0.0

santhosh6328 avatar Nov 24 '22 04:11 santhosh6328

@santhosh6328

Can you attach your source code? I tried similarity for those strings, and it returned 0 (correct). Perhaps you mixed similarity with distance. Those are completely different things.

        System.out.println("Similarity: " + jw.similarity("SOME NAME", ""));
        System.out.println("Distance: " + jw.distance("SOME NAME", ""));

denmase avatar Dec 05 '22 03:12 denmase

Also note that this scenario is covered via unit tests (see the NullEmptyTests class and its usage in the Jaro Winkler unit tests).

paulirwin avatar Aug 29 '23 20:08 paulirwin

这是来自QQ邮箱的自动回复邮件。   您好,我已经收到您的邮件

potatoxf avatar Aug 29 '23 20:08 potatoxf