Welcome to Leven, an efficient, tabulated implementation of the Levenshtein distance algorithm in Elixir. The Levenshtein distance, also known as edit distance, measures the difference between two strings in terms of the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
The package can be installed by adding leven
to your list of dependencies in
mix.exs
:
def deps do
[
{:leven, "~> 1.0"}
]
end
iex(1)> Leven.distance("house", "horses")
2
Two single-character edits are required to get from "house" to "horses":
- Substitute "u" for "r", resulting in "horse"
- Appens "s", resulting in "horses"
To benchmark Leven on your machine, clone the repo and run mix bench
.
Leven is released under the Apache License 2.0
.
This package was written by Elliot Jackson.
- Blog: https://elliotekj.com
- Email: elliot@elliotekj.com