Skip to main content

A really fast levenshtein distance implementation, with early exit.

Project description

Introduction

Rust implementation of levenshtein distance (https://en.wikipedia.org/wiki/Levenshtein_distance), based on Wagner–Fischer_algorithm (https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm).

Installation

pip install fastlevenshtein

Usage

First param is either a list or a str.

It will be compared to the second param that is a str.

The third param is the maximum value of levensthein. For example, if the third param is 3, if the levensthein value reach at least 3, the function with exit and return 3 as value. This third param is used to increase computation time when you are only interested in string that are close to each other. If you do not want to use early exit, you can just use a really high value for this param

from fastlevenshtein import levenshtein
levenshtein("string1", "string2", 999) # 999 so no early exit
>>> 1

from fastlevenshtein import levenshtein_list
levenshtein_list(["string1", "string2"], "string3", 999)
>>> [1, 1]

from fastlevenshtein import levenshtein_list
levenshtein_list(["aaaaaaaa", "bbbbbbbb"], "ccccccc", 3) # early exit at 3 maximum value for levensthein distance
>>> [3, 3]

License

fastlevenshtein 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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastlevenshtein-0.2.1-cp39-cp39-manylinux_2_24_x86_64.whl (176.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64

fastlevenshtein-0.2.1-cp38-cp38-manylinux_2_24_x86_64.whl (176.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

fastlevenshtein-0.2.1-cp37-cp37m-manylinux_2_24_x86_64.whl (176.5 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.24+ x86-64

fastlevenshtein-0.2.1-cp36-cp36m-manylinux_2_24_x86_64.whl (176.4 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.24+ x86-64

File details

Details for the file fastlevenshtein-0.2.1-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for fastlevenshtein-0.2.1-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 83a26f8fe24096c554d0780963ae10ab2e76ba015b24c74ef0973c213a6742ae
MD5 b552698f9bb39f0a35399f5a29da9f47
BLAKE2b-256 504e11c3cb07e5f9d2f4cf3e335eede2b05d91cd4e37875fbcc2b66d567975a0

See more details on using hashes here.

File details

Details for the file fastlevenshtein-0.2.1-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for fastlevenshtein-0.2.1-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 5c3a7597704a71e2f8ec21578c3e8070aabeacc47074065e9cf30c1816a2d252
MD5 901acce2adacadd236fd493ab20e1c98
BLAKE2b-256 6c5fabe96dc73859f37b72ed788f17cdd24c46cc3a729afc7254e93494ef62e4

See more details on using hashes here.

File details

Details for the file fastlevenshtein-0.2.1-cp37-cp37m-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for fastlevenshtein-0.2.1-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 12491d70d9131f507d0680b3a29595f890ca61981be9f71374fab2af61e087ff
MD5 498a1cc5672af1cacb8c42be1f01e59f
BLAKE2b-256 4127bc779f351ae3a62f181d3341132a6f8938c0331cc2be47d6dc28e5cbf2e7

See more details on using hashes here.

File details

Details for the file fastlevenshtein-0.2.1-cp36-cp36m-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for fastlevenshtein-0.2.1-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 165b406fbc95d4bf5404be75a4b24c15951567e9b0a6b3c4e95d6b059e87505f
MD5 f908fb3f841838afa8bd613fb71f5525
BLAKE2b-256 272926cb3dbbedf79faadec3d9de9fede46029b7a4bbb96133e0435b9aa6a484

See more details on using hashes here.

Supported by

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