首页 > 编程语言 > 详细

Jaro-Winkler Distance

时间:2016-11-02 18:05:01      阅读:280      评论:0      收藏:0      [点我收藏+]

 

 

发现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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!