在Python字符串相似度 [英] String similarity metrics in Python

查看:933
本文介绍了在Python字符串相似度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到两个字符串之间字符串的相似性。 页面具有其中的一些例子。 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.

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

将为东西比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.

<一个href="http://www.dcs.shef.ac.uk/~sam/stringmetrics.html">http://www.dcs.shef.ac.uk/~sam/stringmetrics.html

下面是一个有点列表:

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

这篇关于在Python字符串相似度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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