[PATCH 6 of 9 sethelp] levenshtein: import public/CC0 implementation of pure-py levenshtein distance
Matt Mackall
mpm at selenic.com
Wed Feb 4 22:18:22 UTC 2015
On Wed, 2015-02-04 at 13:15 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1422304840 18000
> # Mon Jan 26 15:40:40 2015 -0500
> # Node ID 4b2d400e8c7daa1746de8516f70a3d468bc9c544
> # Parent 232bd67d5c1350c85e9f787e1f3be62a02bb7872
> levenshtein: import public/CC0 implementation of pure-py levenshtein distance
>
> Imported from http://hetland.org/coding/python/levenshtein.py. There
> are other implementations on pypi, but this one is nicely simple and
> unencumbered.
Stock difflib is good enough?
$ python
Python 2.7.5+ (default, Sep 17 2013, 15:31:50)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import difflib
>>> a = difflib.SequenceMatcher(None, "blaze", "belize")
>>> a.ratio()
0.7272727272727273
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list