Simetric provides facilities to perform approximate string matching and measurement of string similarity/distance. The library is focusing on speed and completeness.
- Jaro (has been moved to Elixir's standard library)
- Jaro–Winkler
- Levenshtein
Add Simetric as a dependency to your mix.exs
file:
defp deps do
[{:simetric, "~> 0.2.0"}]
end
Then, run mix deps.get
in your shell to fetch the new dependency.
Jaro–Winkler:
Simetric.Jaro.Winkler.compare("dwayne", "duane") # => 0.8400000000000001
Simetric.Jaro.Winkler.compare("hardin", "martinez") # => 0.7222222222222222
Simetric.Jaro.Winkler.compare("same", "same") # => 1.0
Levenshtein:
Simetric.Levenshtein.compare("gumbo", "gambol") # => 2
Simetric.Levenshtein.compare("kitten", "sitting") # => 3
Simetric is released under the ISC license.