• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Levenshtein类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein的典型用法代码示例。如果您正苦于以下问题:Java Levenshtein类的具体用法?Java Levenshtein怎么用?Java Levenshtein使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Levenshtein类属于uk.ac.shef.wit.simmetrics.similaritymetrics包,在下文中一共展示了Levenshtein类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createSimStringStrategy

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public static InterfaceStringMetric createSimStringStrategy( final SimStringStrategy strategyType )
{
    switch ( strategyType )
    {
        case DICE_COEFF:
            return new DiceSimilarity();
        case JARO:
            return new Jaro();
        case JAROWINKLER:
            return new JaroWinkler();
        case LEVENSTHEIN:
            return new Levenshtein();
        case JACCARD:
            return new JaccardSimilarity();
        case MONGEELKAN:
            return new MongeElkan();
        case QGRAMS:
            return new QGramsDistance();
        default:
            throw new IllegalArgumentException( "No valid SimStringStrategyType!" );
    }
}
 
开发者ID:RUB-NDS,项目名称:WS-Attacker,代码行数:23,代码来源:SimStringStrategyFactory.java


示例2: similarities

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public float[] similarities(String s1, String s2) {
    float[] result = new float[15];
    DiceSimilarity ds = new DiceSimilarity();
    result[0] = ds.getSimilarity(s1, s2);
    CosineSimilarity cs = new CosineSimilarity();
    result[1] = ds.getSimilarity(s1, s2);
    JaccardSimilarity js = new JaccardSimilarity();
    result[2] = js.getSimilarity(s1, s2);
    Levenshtein ls = new Levenshtein();
    result[3] = ls.getSimilarity(s1, s2);
    ChapmanOrderedNameCompoundSimilarity concs = new ChapmanOrderedNameCompoundSimilarity();
    result[4] = concs.getSimilarity(s1, s2);
    BlockDistance bd = new BlockDistance();
    result[5] = bd.getSimilarity(s1, s2);
    Jaro j = new Jaro();
    result[6] = j.getSimilarity(s1, s2);
    JaroWinkler jw = new JaroWinkler();
    result[7] = jw.getSimilarity(s1, s2);
    MongeElkan me = new MongeElkan();
    result[8] = me.getSimilarity(s1, s2);
    NeedlemanWunch nw = new NeedlemanWunch();
    result[9] = nw.getSimilarity(s1, s2);
    SmithWaterman sw = new SmithWaterman();
    result[10] = sw.getSimilarity(s1, s2);
    QGramsDistance qgd = new QGramsDistance();
    result[11] = qgd.getSimilarity(s1, s2);
    Soundex s = new Soundex();
    result[12] = s.getSimilarity(s1, s2);
    EuclideanDistance ed = new EuclideanDistance();
    result[13] = ed.getSimilarity(s1, s2);
    TagLink tl = new TagLink();
    result[14] = tl.getSimilarity(s1, s2);
    return result;
}
 
开发者ID:k0105,项目名称:ensemble,代码行数:35,代码来源:SimilarityScore.java


示例3: filterByLevensteinSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public static List<String> filterByLevensteinSimilarity(List<RankedTitle> tokenTitles) {

        if(tokenTitles.size() == 0){
            throw new IllegalArgumentException("Cannot process an empty list");
        }


        List<String> finalTitles = new ArrayList<String>();
        finalTitles.add(tokenTitles.get(0).getTitle());
        if(tokenTitles.size() < 2){
            return finalTitles;
        }
        
        
        

        AbstractStringMetric metric = new Levenshtein();
        for(int i = 1; i < tokenTitles.size(); i++){
            boolean reject = false;
            for(String title : finalTitles){
                float result = metric.getSimilarity(title, tokenTitles.get(i).getTitle());
                if (result >= 0.7){
                    reject = true;
                    break;
                }
            }
            if(!reject){
                finalTitles.add(tokenTitles.get(i).getTitle());
            }
        }

        return finalTitles;
    }
 
开发者ID:socialsensor,项目名称:trends-labeler,代码行数:34,代码来源:TrendsLabeler.java


示例4: compute

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
@Override
public Object compute(String[] args) throws IllegalArgumentException {
	if(args.length != NUM_ARGS){
		throw new IllegalArgumentException("Expected number of arguments: " + NUM_ARGS);
	}
	AbstractStringMetric metric = new Levenshtein();
	return metric.getSimilarity(args[0], args[1]);
}
 
开发者ID:saikatgomes,项目名称:CS784-Data_Integration,代码行数:9,代码来源:LevenshteinSimilarity.java


示例5: similaritiesVerbose

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public String similaritiesVerbose(String s1, String s2) {
    DiceSimilarity ds = new DiceSimilarity();
    float resultDS = ds.getSimilarity(s1, s2);
    CosineSimilarity cs = new CosineSimilarity();
    float resultCS = ds.getSimilarity(s1, s2);
    JaccardSimilarity js = new JaccardSimilarity();
    float resultJS = js.getSimilarity(s1, s2);
    Levenshtein ls = new Levenshtein();
    float resultLS = ls.getSimilarity(s1, s2);
    ChapmanOrderedNameCompoundSimilarity concs = new ChapmanOrderedNameCompoundSimilarity();
    float resultCONCS = concs.getSimilarity(s1, s2);
    BlockDistance bd = new BlockDistance();
    float resultBD = bd.getSimilarity(s1, s2);
    Jaro j = new Jaro();
    float resultJ = j.getSimilarity(s1, s2);
    JaroWinkler jw = new JaroWinkler();
    float resultJW = jw.getSimilarity(s1, s2);
    MongeElkan me = new MongeElkan();
    float resultME = me.getSimilarity(s1, s2);
    NeedlemanWunch nw = new NeedlemanWunch();
    float resultNW = nw.getSimilarity(s1, s2);
    SmithWaterman sw = new SmithWaterman();
    float resultSW = sw.getSimilarity(s1, s2);
    QGramsDistance qgd = new QGramsDistance();
    float resultQGD = qgd.getSimilarity(s1, s2);
    Soundex s = new Soundex();
    float resultS = s.getSimilarity(s1, s2);
    EuclideanDistance ed = new EuclideanDistance();
    float resultED = ed.getSimilarity(s1, s2);
    TagLink tl = new TagLink();
    float resultTL = tl.getSimilarity(s1, s2);

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("Comparison of strings: \"");
    stringBuilder.append(s1);
    stringBuilder.append("\" and \"");
    stringBuilder.append(s2);
    stringBuilder.append("\"\n\nDice Similarity: ");
    stringBuilder.append(resultDS);
    stringBuilder.append("\nCosine Similarity: ");
    stringBuilder.append(resultCS);
    stringBuilder.append("\nJaccard Similarity: ");
    stringBuilder.append(resultJS);
    stringBuilder.append("\nLevenshtein Distance: ");
    stringBuilder.append(resultLS);
    stringBuilder.append("\nChapman Ordered Name Compound Similarity: ");
    stringBuilder.append(resultCONCS);
    stringBuilder.append("\nBlock Distance: ");
    stringBuilder.append(resultBD);
    stringBuilder.append("\nJaro: ");
    stringBuilder.append(resultJ);
    stringBuilder.append("\nJaro-Winkler: ");
    stringBuilder.append(resultJW);
    stringBuilder.append("\nMonge-Elkan: ");
    stringBuilder.append(resultME);
    stringBuilder.append("\nNeedleman-Wunch: ");
    stringBuilder.append(resultNW);
    stringBuilder.append("\nSmith-Waterman: ");
    stringBuilder.append(resultSW);
    stringBuilder.append("\nQGrams Distance: ");
    stringBuilder.append(resultQGD);
    stringBuilder.append("\nSoundex: ");
    stringBuilder.append(resultS);
    stringBuilder.append("\nEuclidean Distance: ");
    stringBuilder.append(resultED);
    stringBuilder.append("\nTag Link: ");
    stringBuilder.append(resultTL);
    return stringBuilder.toString();
}
 
开发者ID:k0105,项目名称:ensemble,代码行数:70,代码来源:SimilarityScore.java


示例6: SimilarityWordConfiguration

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
SimilarityWordConfiguration() {

    super();
    
    setAssociateScore(true);
    
    THRESHOLD = 0.5f;
    
    STRING_METRICS = new DualHashBidiMap();
    STRING_METRICS.put("Levenshtein", new Levenshtein());
    STRING_METRICS.put("Jaro", new Jaro());
    STRING_METRICS.put("Jaro Winkler", new JaroWinkler());
    
    STRING_METRIC = new Levenshtein();
    
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:17,代码来源:SimilarityWordConfiguration.java


示例7: HighestOccurrenceSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public HighestOccurrenceSimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:HighestOccurrenceSimilarity.java


示例8: HighestSISimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public HighestSISimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:HighestSISimilarity.java


示例9: BasenameSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public BasenameSimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:BasenameSimilarity.java


示例10: SLSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public SLSimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:SLSimilarity.java


示例11: HighestVariantNameSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public HighestVariantNameSimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:HighestVariantNameSimilarity.java


示例12: AssociationStringSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public AssociationStringSimilarity() {
    stringMetric = new Levenshtein();
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:AssociationStringSimilarity.java


示例13: LEVMatch

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public static boolean LEVMatch(String str1, String str2, double threshold){
	Levenshtein lev = new Levenshtein();
	float thresh = lev.getSimilarity(str1, str2);
	return thresh > threshold;
}
 
开发者ID:openmrs,项目名称:openmrs-module-patientmatching,代码行数:6,代码来源:StringMatch.java


示例14: getLEVMatchSimilarity

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public static float getLEVMatchSimilarity(String str1, String str2){
	Levenshtein lev = new Levenshtein();
	float thresh = lev.getSimilarity(str1, str2);
	return thresh;
}
 
开发者ID:openmrs,项目名称:openmrs-module-patientmatching,代码行数:6,代码来源:StringMatch.java


示例15: LEVMatch

import uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein; //导入依赖的package包/类
public static float LEVMatch(String str1, String str2){
	Levenshtein lev = new Levenshtein();
	float thresh = lev.getSimilarity(str1, str2);
	return thresh;
}
 
开发者ID:openmrs,项目名称:openmrs-module-patientmatching,代码行数:6,代码来源:ComparatorTesting.java



注:本文中的uk.ac.shef.wit.simmetrics.similaritymetrics.Levenshtein类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Highlight类代码示例发布时间:2022-05-22
下一篇:
Java CLICommandCacheAdmin类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap