帮我找到算法名称 - 量化两个单词之间的差异
我知道有一种算法可以查看两个单词在一起的“接近”程度。这个算法的想法是,对于将一个单词转换为另一个单词所需的每一个字母加法或减法,该算法都会在分数上增加 1 分。这个分数越低,两个词在一起就越“接近”。
例如,如果我们使用单词“word”和“sword”,它们的距离为1。要从“word”到“sword”,您只需在开头添加“s”即可。
对于“week”和“welk”,距离为 2。您需要减去“e”并添加“l”。
我记得这个算法用于对拼写检查器中的建议列表进行排序。我不记得这个算法的名字了。
这个算法叫什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
编辑距离
是我个人的问题还是这个简单的算法很棒?
Levenshtein Distance
Is it just me or is this simple algorithm great?
这听起来很像 Levenshtein 距离算法
This sounds a lot like the Levenshtein distance algorithm
编辑距离。
Levenshtein distance.
编辑距离
http://en.wikipedia.org/wiki/Levenshtein_distance
Levenshtein distance
http://en.wikipedia.org/wiki/Levenshtein_distance
您的意思是编辑距离吗?
Do you mean Levenshtein distance?