在Python字符串相似度字符串、相似、Python

2023-09-10 23:00:12 作者:孤城傲影

我想找到两个字符串之间字符串的相似性。 此页面具有其中的一些例子。 Python就 Levenshtein算法的implemnetation。是否有更好的算法,(希望一个Python库),根据这些约束上。

I want to find string similarity between two strings. This page has examples of some of them. Python has an implemnetation of Levenshtein algorithm. Is there a better algorithm, (and hopefully a python library), under these contraints.

我想要做的字符串之间的模糊匹配。如火柴(你好,你的人','你好,你peopl)应返回true 漏报是可以接受的,误报,除了在极个别情况下并非如此。 这是在一个非实时设置来完成,所以速度是令人关注的不是(多)。 我比较多的字串。

将为东西比Levenshtein距离(或莱文斯坦的比例)等是一个更好的算法,我的情况?

Would something other than Levenshtein distance(or Levenshtein ratio) be a better algorithm for my case?

推荐答案

有在谢菲尔德大学字符串相似度一个很好的资源。它有各种指标的清单(不仅仅是莱文斯坦),并有他们的开源实现。貌似很多人应该很容易改编成的Python。

There's a great resource for string similarity metrics at University of Sheffield. It has a list of various metrics (beyond just Levenshtein) and has open-source implementations of them. Looks like many of them should be easy to adapt into Python.

http://www.dcs.shef.ac.uk/~sam/stringmetrics.html

下面是一个有点列表:

汉明距离 Levenshtein距离 的Needleman-Wunch距离或卖家算法 等等...