Expand description
Levenshtein distance and ratio algorithms.
These are implemented from scratch — the library has zero external dependencies and this module must not introduce any.
§Algorithms
levenshtein_distance— the classic edit distance (insertions, deletions, substitutions each cost 1).levenshtein_ratio— a normalised similarity score in[0.0, 1.0]derived from the distance. Two identical strings score1.0; two completely different strings of maximum length score0.0.
Functions§
- levenshtein_
distance - Compute the Levenshtein edit distance between two strings.
- levenshtein_
ratio - Compute the normalised Levenshtein similarity ratio between two strings.