csimilarity = new Jaro().score( cacheValue, lookupvalue ); break; case FuzzyMatchMeta.OPERATION_TYPE_JARO_WINKLER:
public String explainScore(StringWrapper s, StringWrapper t) { String str1 = s.unwrap(); String str2 = t.unwrap(); int halflen = halfLengthOfShorter(str1,str2); String common1 = commonChars(str1, str2, halflen); String common2 = commonChars(str2, str1, halflen); // count transpositions if (common1.length()!=common2.length()) return "common1!=common2: '"+common1+"' != '"+common2+"'\nscore: "+score(s,t)+"\n"; if (common1.length()==0 || common2.length()==0) return "|commoni|=0: common1='"+common1+"' common2='"+common2+"'\nscore: "+score(s,t)+"\n"; int transpositions = transpositions(common1,common2); String explanation = "common1: '"+common1+"'\n" + "common2: '"+common2+"'\n" + "transpositions: "+transpositions+"\n"; return explanation + "score: " + score(s,t)+"\n"; }
public String explainScore(StringWrapper s, StringWrapper t) { String str1 = s.unwrap(); String str2 = t.unwrap(); int halflen = halfLengthOfShorter(str1,str2); String common1 = commonChars(str1, str2, halflen); String common2 = commonChars(str2, str1, halflen); // count transpositions if (common1.length()!=common2.length()) return "common1!=common2: '"+common1+"' != '"+common2+"'\nscore: "+score(s,t)+"\n"; if (common1.length()==0 || common2.length()==0) return "|commoni|=0: common1='"+common1+"' common2='"+common2+"'\nscore: "+score(s,t)+"\n"; int transpositions = transpositions(common1,common2); String explanation = "common1: '"+common1+"'\n" + "common2: '"+common2+"'\n" + "transpositions: "+transpositions+"\n"; return explanation + "score: " + score(s,t)+"\n"; }
public String explainScore(StringWrapper s, StringWrapper t) { String str1 = s.unwrap(); String str2 = t.unwrap(); int halflen = halfLengthOfShorter(str1,str2); String common1 = commonChars(str1, str2, halflen); String common2 = commonChars(str2, str1, halflen); // count transpositions if (common1.length()!=common2.length()) return "common1!=common2: '"+common1+"' != '"+common2+"'\nscore: "+score(s,t)+"\n"; if (common1.length()==0 || common2.length()==0) return "|commoni|=0: common1='"+common1+"' common2='"+common2+"'\nscore: "+score(s,t)+"\n"; int transpositions = transpositions(common1,common2); String explanation = "common1: '"+common1+"'\n" + "common2: '"+common2+"'\n" + "transpositions: "+transpositions+"\n"; return explanation + "score: " + score(s,t)+"\n"; }
/** * Test if titles match * In this implementation the jaro similarity metric is used to compare string values. * Very similar strings will have a jaro score close to 1. Different strings have a * jaro score close to 0. * @param s1 title 1 * @param s2 title 2 * @return true if jaro.score(title1, title2) > threshold (threshold defaults to 0.9) */ public boolean valuesMatch(String s1, String s2) { StringWrapper sw1 = new BasicStringWrapper(s1); StringWrapper sw2 = new BasicStringWrapper(s2); Jaro jro = new Jaro(); double tmp = jro.score(sw1, sw2); if (tmp > threshold) return true; else return false; }