Skip to main content

A Python3 Levenshtein distance (re)implementation of pylev

Project description

A Python3 Levenshtein distance (re)implementation of pylev.

Calculation of Levenshtein distance between strings. Based on the Wikipedia code samples.

What’s new?


  • Python Python 3.3+ or PyPy3


pip install pylev3


Usage is fairly straightforward:

from pylev3 import Levenshtein
assert Levenshtein.classic('', 'cat'), 3
assert Levenshtein.damerau('cat', 'cat'), 0
assert'kitten', 'sitting'), 3
assert Levenshtein.wfi(['cat', 'kitten'], 'abc'), [3, 6]
assert Levenshtein()(['cat', 'kitten'], ['cat', 'abc']), [[0, 3], [5, 6]]

Or use old way (like in pylev):

from pylev3 import wf_levenshtein, wfi_levenshtein, damerau_levenshtein, classic_levenshtein
assert classic_levenshtein('', 'cat'), 3
assert damerau_levenshtein('cat', 'cat'), 0
assert wf_levenshtein('kitten', 'sitting'), 3
assert wfi_levenshtein(['cat', 'kitten'], 'abc'), [3, 6]
assert wf_levenshtein(['cat', 'kitten'], ['cat', 'abc']), [[0, 3], [5, 6]]


New BSD (as authored).


# get
$ git clone
$ cd pylev3
# run
$ python -m unittest tests

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pylev3, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pylev3-1.1.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page