码迷,mamicode.com
首页 > 编程语言 > 详细

Jaro-Winkler Distance

时间:2016-11-02 18:07:15      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:win   cond   prefix   first   mon   stat   throw   nbsp   har   

 

 

发现commons-lang 中有实现:

StringUtils.class

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;
}

Jaro-Winkler Distance

标签:win   cond   prefix   first   mon   stat   throw   nbsp   har   

原文地址:http://www.cnblogs.com/lykm02/p/6023608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!