scikitplot.levenshtein#

Levenshtein distance facade with safe optional acceleration.

scikitplot.levenshtein is always importable. The default backend chain is bundled Cython -> RapidFuzz -> dependency-free Python. The GPL-licensed Levenshtein package is available only when explicitly requested.

User guide. See the Levenshtein distance and fuzzy matching section for further details.

Backend-neutral Levenshtein edit distance helpers.#

BackendInfo

Read-only description of one implementation backend.

Match

One ranked fuzzy-match result with actual backend provenance.

available_backends

Return backend capability records in preferred order.

backend_info

Return capability information for one backend.

closest

Return the closest choice, or None for an empty iterable.

distance

Return the Levenshtein edit distance between two sequences.

make_corpus_scorer

Return a scorer compatible with corpus.CustomRetrievalIndex.

normalized_distance

Return distance normalised to [0, 1] by maximum sequence length.

normalized_similarity

Return normalised Levenshtein similarity in [0, 1].

rank

Rank choices from most to least similar to query.

similarity

Return max(len(a), len(b)) - distance(a, b).