Skip to main content

A pure Python Levenshtein implementation that's not freaking GPL'd.

Project description

A pure Python Levenshtein implementation that’s not freaking GPL’d.

Based off the Wikipedia code samples at http://en.wikipedia.org/wiki/Levenshtein_distance.

Requirements

  • Python 2.7.X, Python 3.3+ or PyPy 1.6.0+

Usage

Usage is fairly straightforward:

import pylev
distance = pylev.levenshtein('kitten', 'sitting')
assert distance == 3

License

New BSD.

Tests

Setup:

$ git clone https://github.com/toastdriven/pylev.git
$ cd pylev

Running:

$ python -m unittest tests
https://travis-ci.com/toastdriven/pylev.svg?branch=main

Version History

  • v1.4.0

    • Updated for current versions of Python

    • Integrated a better Travis matrix. Thanks to @grainert!

    • Fixed mistaken docs about the assert. Thanks to @adamchainz!

    • Reorganized the package.

    • Blacked all the source code.

  • v1.3.0

    • Implemented a considerably faster variants (orders of magnitude).

    • Tested & working on Python 2.7.4, Python 3.3.1 & PyPy 1.9.0.

  • v1.2.0

    • Fixed all incorrect spellings of “Levenshtein” (there’s no “c” in it).

    • Old methods are aliased for backward-compatibility.

  • v1.1.0

    • Implemented a much faster variant (several orders of magnitude).

    • The older variant was renamed to classic_levenschtein.

    • Tested & working on Python 3.3 & PyPy 1.6.0 as well.

  • v1.0.2

    • Python packaging is REALLY hard. Including the README this time.

  • v1.0.1

    • Python packaging is hard. Including the README this time.

  • v1.0.0

    • Initial release, just the naive implementation of Levenshtein.

Project details


Download files

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

Source Distribution

pylev-1.4.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

pylev-1.4.0-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pylev-1.4.0.tar.gz.

File metadata

  • Download URL: pylev-1.4.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.4

File hashes

Hashes for pylev-1.4.0.tar.gz
Algorithm Hash digest
SHA256 9e77e941042ad3a4cc305dcdf2b2dec1aec2fbe3dd9015d2698ad02b173006d1
MD5 145afdcec514607149e884968911a770
BLAKE2b-256 11f2404d2bfa30fb4ee7c7a7435d593f9f698b25d191cafec69dd0c726f02f11

See more details on using hashes here.

Provenance

File details

Details for the file pylev-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pylev-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.4

File hashes

Hashes for pylev-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b2e2aa7b00e05bb3f7650eb506fc89f474f70493271a35c242d9a92188ad3dd
MD5 4021e7b562f8ddf50c22070f744ccee9
BLAKE2b-256 047895cfe72991d22994f0ec5a3b742b31c95a28344d33e06b69406b68398a29

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page