Skip to main content

A Rust-based levenshtein distance implementation.

Project description

Introduction

Rust implementation of levenshtein distance (https://en.wikipedia.org/wiki/Levenshtein_distance).

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

fastlevenshtein-0.1.7-cp38-cp38-manylinux_2_28_x86_64.whl (175.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

fastlevenshtein-0.1.7-cp37-cp37m-manylinux_2_28_x86_64.whl (175.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.28+ x86-64

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