tdebatty / java-string-similarity

Implementation of various string similarity and distance algorithms: Levenshtein, Jaro-winkler, n-Gram, Q-Gram, Jaccard index, Longest Common Subsequence edit distance, cosine similarity ...
Other
2.69k stars 409 forks source link

Jaro winkler similarity on Empty strings #65

Open santhosh6328 opened 1 year ago

santhosh6328 commented 1 year ago

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

denmase commented 1 year ago

@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", ""));
paulirwin commented 1 year ago

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

potatoxf commented 1 year ago

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