当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.getLevenshteinDistance方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.StringUtils.getLevenshteinDistance方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.getLevenshteinDistance方法的具体用法?Java StringUtils.getLevenshteinDistance怎么用?Java StringUtils.getLevenshteinDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.getLevenshteinDistance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findCalendarName

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String findCalendarName(final String calendarName) {
  final String nCalendarName = calendarName.toLowerCase();
  Map<String, Integer> distances = new HashMap<>();

  for(String curCalendarName : getCalendarNames()) {
    String nCurCalendarName = curCalendarName.toLowerCase();
    int distance = StringUtils.getLevenshteinDistance(nCalendarName, nCurCalendarName);

    if(distance <= 3 || nCurCalendarName.contains(nCalendarName)) {
      distances.put(curCalendarName, distance);
    }
  }

  if(distances.size() == 1) {
    return distances.keySet().stream().findFirst().get();
  }

  return null;
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:20,代码来源:NewEventSpeechlet.java

示例2: testSimilar

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
     * Testing if the responses of two requests are similar. This is the not the same as the same, rather there is a
     * threshold set in the static parameters of the class.
     * @param firstString
     * @param secondString
     * @return Test if similar
     */
    private static boolean testSimilar(String firstString, String secondString) {
//        int fuzzyDist = StringUtils.getFuzzyDistance(firstString, secondString, Locale.getDefault());
        double jaroDist = StringUtils.getJaroWinklerDistance(firstString, secondString);
        int levenDist = StringUtils.getLevenshteinDistance(firstString, secondString);

//        BurpExtender.print("============================================");
//        BurpExtender.print("Fuzzy Distance:" + fuzzyDist);
//        BurpExtender.print("        Jaro Winkler Distance:" + jaroDist);
//        BurpExtender.print("        Levenshtein Distance:" + levenDist);
//        BurpExtender.print("============================================");

        return jaroDist >= JARO_THRESHOLD || levenDist <= LEVENSHTEIN_THRESHOLD;
    }
 
开发者ID:SpiderLabs,项目名称:Airachnid-Burp-Extension,代码行数:21,代码来源:RequestSender.java

示例3: evaluate

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
  String str0 = getStringValue(arguments, 0, converters);
  String str1 = getStringValue(arguments, 1, converters);

  if (str0 == null || str1 == null) {
    return null;
  }

  int dist = StringUtils.getLevenshteinDistance(str0, str1);
  output.set(dist);
  return output;
}
 
开发者ID:myui,项目名称:hive-udf-backports,代码行数:14,代码来源:GenericUDFLevenshtein.java

示例4: computeStringDistance

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
double computeStringDistance(CharSequence s1, CharSequence s2) {
    return StringUtils.getLevenshteinDistance(s1, s2);
}
 
开发者ID:Lambda-3,项目名称:Stargraph,代码行数:5,代码来源:LevenshteinRanker.java

示例5: levenshteinDistance

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private int levenshteinDistance(String s1, String s2) {
    return StringUtils.getLevenshteinDistance(s1, s2);
}
 
开发者ID:ETspielberg,项目名称:bibliometrics,代码行数:4,代码来源:Article.java


注:本文中的org.apache.commons.lang3.StringUtils.getLevenshteinDistance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。