View Source Levenshtein2 (superls v1.1.1)

For what is Levenshtein distance see:

https://en.wikipedia.org/wiki/Levenshtein_distance

Summary

Functions

Returns an integer representing Levenshtein distance between source and target.

Functions

Link to this function

distance(source, target)

View Source
@spec distance(String.t(), String.t()) :: non_neg_integer()

Returns an integer representing Levenshtein distance between source and target.

Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one word into the other.

The algorithm used is based on the Wagner-Fisher iterative implementation.

Examples

iex> Levenshtein.distance("same", "same")
0
iex> Levenshtein.distance("kitten", "sitting")
3