Skip to main content

Package for calculating Levenshtein distance and similarity

Project description

The Levenshtein distance is a string metric for measuring the difference between two strings. With this package you can calculate the Levenshtein distance and ratio between two words, or get the most similar word in a list of words.

More info at https://en.wikipedia.org/wiki/Levenshtein_distance

Installation

pip install levenshtein-package

Available methods

  • calculate_distance

  • calculate_similarity

  • get_most_similar_in_list

Examples

>>> from levenshtein import calculate_distance, calculate_similarity, get_most_similar_in_list

>>> calculate_distance("apple", "pear")
4

>>> calculate_similarity("apple", "pear")
0.4444444444444444

>>> get_most_similar_in_list("apple", ["pear", "peach", "apricot", "banana"])
'pear'

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-package-0.0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

levenshtein_package-0.0.2-py2.py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 2 Python 3

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