TheFuzz.Similarity.Jaro (TheFuzz v0.6.0)

View Source

Calculates the Jaro Distance between two strings.

Summary

Functions

Calculates the Jaro distance between two strings. This used to be implemented here, but since Elixir 1.1, Jaro is part of the standard lib. This now uses the std lib call, but returns nil if either string is empty to preserve backwards compatibility with this library's original code.

Functions

compare(string1, string2)

Calculates the Jaro distance between two strings. This used to be implemented here, but since Elixir 1.1, Jaro is part of the standard lib. This now uses the std lib call, but returns nil if either string is empty to preserve backwards compatibility with this library's original code.

Examples

iex> TheFuzz.Similarity.Jaro.compare("abc", "")
nil
iex> TheFuzz.Similarity.Jaro.compare("abc", "xyz")
0.0
iex> TheFuzz.Similarity.Jaro.compare("compare me", "compare me")
1.0
iex> TheFuzz.Similarity.Jaro.compare("natural", "nothing")
0.5238095238095238