Editdistance

0.8.1 · abandoned · verified Fri Apr 10

Editdistance is a Python library providing a fast, C++ and Cython-optimized implementation of the Levenshtein (edit) distance. It efficiently calculates the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one sequence into the other. The library is suitable for applications requiring high-performance string similarity calculations, such as fuzzy matching, data cleaning, and natural language processing. The current version is 0.8.1, but the project's GitHub repository has been archived, indicating it is no longer actively maintained by the owner.

Warnings

Install

Imports

Quickstart

This example demonstrates how to calculate the Levenshtein distance between two strings or two sequences of hashable objects using the `editdistance.eval()` function.

import editdistance

# Calculate edit distance between two strings
distance = editdistance.eval('kitten', 'sitting')
print(f"Edit distance between 'kitten' and 'sitting': {distance}")

# Works with any iterable of hashable objects (e.g., lists of words)
distance_list = editdistance.eval(['spam', 'egg'], ['spam', 'ham'])
print(f"Edit distance between ['spam', 'egg'] and ['spam', 'ham']: {distance_list}")

view raw JSON →