Jaro-Winkler Distance

 

 

發現commons-lang 中有實現:get

StringUtils.classio

public static double getJaroWinklerDistance(final CharSequence first, final CharSequence second) {    final double DEFAULT_SCALING_FACTOR = 0.1;    if (first == null || second == null) {        throw new IllegalArgumentException("Strings must not be null");    }    final double jaro = score(first,second);    final int cl = commonPrefixLength(first, second);    final double matchScore = Math.round((jaro + (DEFAULT_SCALING_FACTOR * cl * (1.0 - jaro))) *100.0)/100.0;    return  matchScore;}
相關文章
相關標籤/搜索