帮我找到算法名称-量化两个词之间的差异 [英] Help me find the algorithm name - quantify difference between two words

查看:47
本文介绍了帮我找到算法名称-量化两个词之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有一种算法可以查看两个单词如何接近"在一起.想法是,对于将一个单词转换为另一个单词所必需的每个单字母加法或减法,该算法都会在得分上增加1分.分数越低,两个词就越接近".

例如,如果我们使用单词"word"和"sword",则它们之间的距离为1.要从"word"到"sword",您只需在开头添加"s"即可.

对于周"和周",距离为2.您需要减去"e"并添加"l".

我记得该算法用于对拼写检查程序中的建议列表进行排序.我不记得这个算法的名字.

此算法称为什么?

解决方案

Levenshtein距离

是我还是这个简单的算法很棒?

I know there is an algorithm for seeing how "close" two words are together. The idea is that this algorithm adds 1 point to the score for every single letter addition or subtraction that is necessary to transform one word into the other. The lower this score, the "closer" the two words are together.

For example, if we take the word "word" and "sword", their distance is 1. To go from "word" to "sword" all you have to do as add an "s" in the beginning.

For "week" and "welk" the distance is 2. You need to subtract the "e" and add an "l".

I remember this algorithm is used for sorting the suggestion list in spell-checkers. I cannot recall the name of this algo.

What is this algorithm called?

解决方案

Levenshtein Distance

Is it just me or is this simple algorithm great?

这篇关于帮我找到算法名称-量化两个词之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆