Skip to main content

Python extension for computing string edit distances and similarities.

Project description

This is a fork to get wheels on PyPI. It is a work in progress.

Introduction

The Levenshtein Python C extension module contains functions for fast computation of

  • Levenshtein (edit) distance, and edit operations

  • string similarity

  • approximate median strings, and generally string averaging

  • string sequence and set similarity

It supports both normal and Unicode strings.

Python 2.2 or newer is required; Python 3 is supported.

StringMatcher.py is an example SequenceMatcher-like class built on the top of Levenshtein. It misses some SequenceMatcher’s functionality, and has some extra OTOH.

Levenshtein.c can be used as a pure C library, too. You only have to define NO_PYTHON preprocessor symbol (-DNO_PYTHON) when compiling it. The functionality is similar to that of the Python extension. No separate docs are provided yet, RTFS. But they are not interchangeable:

  • C functions exported when compiling with -DNO_PYTHON (see Levenshtein.h) are not exported when compiling as a Python extension (and vice versa)

  • Unicode character type used with -DNO_PYTHON is wchar_t, Python extension uses Py_UNICODE, they may be the same but don’t count on it

Installation

pip install python-Levenshtein

Documentation

gendoc.sh generates HTML API documentation, you probably want a selfcontained instead of includable version, so run in ./gendoc.sh --selfcontained. It needs Levenshtein already installed and genextdoc.py.

License

Levenshtein is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See the file COPYING for the full text of GNU General Public License version 2.

History

This package was long missing from the Python Package Index and available as source checkout only, but can now be found on PyPI again.

We needed to restore this package for Go Mobile for Plone and Pywurfl projects which depend on this.

Source code

Authors

  • Maintainer: Antti Haapala <antti@haapala.name>

  • Python 3 compatibility: Esa Määttä

  • Jonatas CD: Fixed documentation generation

  • Previous maintainer: Mikko Ohtamaa

  • Original code: David Necas (Yeti) <yeti at physics.muni.cz>

Changelog

0.12.0

  • Fixed a bug in StringMatcher.StringMatcher.get_matching_blocks / extract_editops for Python 3; now allow only str editops on both Python 2 and Python 3, for simpler and working code.

  • Added documentation in the source distribution and in GIT

  • Fixed the package layout: renamed the .so/.dll to _levenshtein, and made it reside inside a package, along with the StringMatcher class.

  • Fixed spelling errors.

0.11.2

  • Fixed a bug in setup.py: installation would fail on Python 3 if the locale did not specify UTF-8 charset (Felix Yan).

  • Added COPYING, StringMatcher.py, gendoc.sh and NEWS in MANIFEST.in, as they were missing from source distributions.

0.11.1

  • Added Levenshtein.h to MANIFEST.in

0.11.0

  • Python 3 support, maintainership passed to Antti Haapala

0.10.1 - 0.10.2

  • Made python-Lehvenstein Git compatible and use setuptools for PyPi upload

  • Created HISTORY.txt and made README reST compatible

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

levenshtein-0.12.0.tar.gz (54.9 kB view details)

Uploaded Source

Built Distributions

levenshtein-0.12.0-cp39-cp39-win_amd64.whl (82.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

levenshtein-0.12.0-cp39-cp39-manylinux1_x86_64.whl (160.1 kB view details)

Uploaded CPython 3.9

levenshtein-0.12.0-cp39-cp39-macosx_10_14_x86_64.whl (80.1 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

levenshtein-0.12.0-cp38-cp38-win_amd64.whl (82.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

levenshtein-0.12.0-cp38-cp38-manylinux1_x86_64.whl (159.9 kB view details)

Uploaded CPython 3.8

levenshtein-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl (80.3 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

levenshtein-0.12.0-cp37-cp37m-win_amd64.whl (82.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

levenshtein-0.12.0-cp37-cp37m-manylinux1_x86_64.whl (158.0 kB view details)

Uploaded CPython 3.7m

levenshtein-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl (80.3 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

levenshtein-0.12.0-cp36-cp36m-win_amd64.whl (82.5 kB view details)

Uploaded CPython 3.6m Windows x86-64

levenshtein-0.12.0-cp36-cp36m-manylinux1_x86_64.whl (158.0 kB view details)

Uploaded CPython 3.6m

levenshtein-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl (80.3 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

levenshtein-0.12.0-cp35-cp35m-win_amd64.whl (82.5 kB view details)

Uploaded CPython 3.5m Windows x86-64

levenshtein-0.12.0-cp35-cp35m-manylinux1_x86_64.whl (158.0 kB view details)

Uploaded CPython 3.5m

levenshtein-0.12.0-cp35-cp35m-macosx_10_14_x86_64.whl (80.3 kB view details)

Uploaded CPython 3.5m macOS 10.14+ x86-64

File details

Details for the file levenshtein-0.12.0.tar.gz.

File metadata

  • Download URL: levenshtein-0.12.0.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0.tar.gz
Algorithm Hash digest
SHA256 d2e8ffe1e2e3e69dc2850ef1151dee61349018bf8d538b1c34dd6a8f594973f6
MD5 3339c02e31a847b51ecd75a11ec5331c
BLAKE2b-256 c30b9cecc379de5320dd8bcb420a315aae1aa9e5d898320ed5a3fe9d1f02d634

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 82.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a84dd0ffd48c2e9555766dc9603a2481105b640e5d98be8d019a9e104e8c5dc7
MD5 16acadae83cd33b9167c24843be7f809
BLAKE2b-256 5755ecf88c29fea290b4e7fd2312a6279e15d470dc3c653e23aab39ede69eff9

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 160.1 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1407b49f4cc47d2d952e5bc2df562178da2e38d618fa1b3e508bede50ff9dc32
MD5 e74e6118501a5488bfe9c327910c3319
BLAKE2b-256 bd94f40c732bbe3fd01df7c96b165359f73149b1fa0748993f769b5d2a513c8d

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 80.1 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 04211a798724067b4faf81b5392d765a78a972f60464b20b0a69a55f1f37b996
MD5 8a44fa462433a3630d78e7433950f496
BLAKE2b-256 1847b5ac82bf82cfb7d6a75f8a896dcc7f4d13559b41e9c2ff3bd7019cd7307a

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for levenshtein-0.12.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 188e1d2f579ab88639aa06f8471a63457c18f9e056f09fd93d8f2337b118e6e5
MD5 4ba9ed534ba7e0f5cd5a22f7d53bdeb0
BLAKE2b-256 20571472f6836c5c10efe96f7d755863f963e3c95338139664beee1bc75e45d0

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 159.9 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 548c9159dc863bb03020d6b5cc7198f94924ea6037faf1026789ec39e5bc6f2e
MD5 d990b25709d57168b772f8fb1067df27
BLAKE2b-256 e4a51b5daa782fe6951c28f1f8277ea9f9ef7f6834f63973f35301ed93f00471

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 80.3 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.6

File hashes

Hashes for levenshtein-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 db3a679d75c979862433f41ae4fbb3b48227a3d2320580f6fc76373dbc7cae2f
MD5 69d0d1d55b68f7355e94babdbf26d575
BLAKE2b-256 bcef2643d1f5552849fe61d170e797aa0c15c4b663150baa353f85130d48a2e7

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.9

File hashes

Hashes for levenshtein-0.12.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 68b496d20995ca71ec35560026b9a96e93bd276d61a3e7c68ddf5fb93915102e
MD5 1880b3f07205480c968f3003f21c617b
BLAKE2b-256 04d9277e2ac722f066d2aaa2bc84680131fd90cc6cad4931ea80f1ea1196557d

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 158.0 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 46a5a39dfd6e700674bf61095f309d780c417ffd62c041c8e3122d1bf4531010
MD5 a77bb08cb5c80aaec1569c09cd1f08fc
BLAKE2b-256 8e41ff25ae28c972a63abde29cd5cea7c648ae0e16b334693cede0522e66dd68

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 80.3 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.9

File hashes

Hashes for levenshtein-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 684f7365dc51b89a37ea7a868c95aa5f05bd80094da3322329552c7456d8894d
MD5 edc5da46a2aacb168142f4796174c272
BLAKE2b-256 ed245f610b0ad241c466370a5f2c54b88e136e00087e52676f48ca954ea37cd5

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.8

File hashes

Hashes for levenshtein-0.12.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 968160e1f6d5be09dbfe3f74dd1e13cbf3540f2a046a7316c014f495a97ca89e
MD5 31fc07682d36b0d788b39e289281de35
BLAKE2b-256 352115aba210e1e932c411f5528fc73a98774a1686b9b70bcfd2b52137da7d8c

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 158.0 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1ecb1e9047a5920710548107dbfba75b304d68e394010094a60301f07b3539a0
MD5 a81622c969a6539bfac3a173f765e486
BLAKE2b-256 7b708a946e92a49a2e38772e50b2f310088c346b5cd3e797f8370ac68d12f9b0

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 80.3 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for levenshtein-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6c58d0e65720de449bd9c5232666faedb83782b2bad896b7412008b275185bcc
MD5 b95637bdd35ad5d01d87d2240394804d
BLAKE2b-256 4f0c6cc30f1f0f917494c388ef8d5ee3d6194de39c303fd63ecb953507e65398

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.5.4

File hashes

Hashes for levenshtein-0.12.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 aff2d83198c276fb56ff2aa13b9f15012d8885137c23e6cf118ebef15d27e0bf
MD5 766fc3cd74b585cdfb42c8d5f3a3d152
BLAKE2b-256 edaf7cd1320c0cb70cdc81f8f26570343ca423079494edb855ea64dc3000a870

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 158.0 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for levenshtein-0.12.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ad0749fce324e080a4d19406309c118b18be55d4599ee9a70663c9352e6b7a1e
MD5 b14502bc9f4348f3406d08da42bc63f9
BLAKE2b-256 80ce9b47fa7db5d2297eb165fb71a80c3e0de1955ce46d3fda23a7e5fe7bf13d

See more details on using hashes here.

File details

Details for the file levenshtein-0.12.0-cp35-cp35m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: levenshtein-0.12.0-cp35-cp35m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 80.3 kB
  • Tags: CPython 3.5m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.5.10

File hashes

Hashes for levenshtein-0.12.0-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3765ffa156f688fb4487b1a7e8e766d3e58f8ee1f13a5ddd5c7c2f38ca29ba9c
MD5 31092343fc829305871ac2ad89629f2a
BLAKE2b-256 5a7d0903641460a74fea7a5053a5b8b819bc029d477efbd47f8603c9ffef6cec

See more details on using hashes here.

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