Here's a patch:
--- Jaro.java.orig 2004-04-14 10:21:34.000000000 +0200
+++ Jaro.java 2004-04-14 10:21:26.000000000 +0200
@@ -51,7 +51,7 @@
private int halfLengthOfShorter(String
str1,String str2)
{
- return (str1.length() > str2.length())
? str1.length()/2 + 1 : str2.length()/2 + 1;
+ return (str1.length() < str2.length())
? str1.length()/2 + 1 : str2.length()/2 + 1;
}
private String commonChars(String s,String
t,int halflen)
Logged In: YES
user_id=1065449
This doesn't completely fix the problem. For example, even
with this fix:
$java com.wcohen.secondstring.Jaro hello-my-name-is-jon j-hi-jon
common1: 'ho--n'
common2: '-h-on'
transpositions: 1
score: 0.5583333333333333
common1 and common2 should both have the character 'j'