TheFuzz v0.5.0 TheFuzz.Similarity.Jaro View Source

Calculates the Jaro Distance between two strings.

Link to this section 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

Link to this section Functions

Link to this function

compare(string1, string2) View Source

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