TheFuzz.Similarity.WeightedLevenshtein

This module contains function to calculate the weighted levenshtein distance between 2 given strings.

Source

Summary

compare(a, b)

Calculates the weighted levenshtein distance between the given strings with the costs of insert, delete, replace as 1

compare(a, b, weights)

Calculates the weighted levenshtein distance between the given strings with costs for insert, delete and replace provided as a Map in the third argument

Functions

compare(a, b)

Calculates the weighted levenshtein distance between the given strings with the costs of insert, delete, replace as 1.

Examples

iex> TheFuzz.Similarity.WeightedLevenshtein.compare("kitten", "sitting")
3
iex> TheFuzz.Similarity.WeightedLevenshtein.compare("sunday", "saturday")
3
Source
compare(a, b, weights)

Calculates the weighted levenshtein distance between the given strings with costs for insert, delete and replace provided as a Map in the third argument.

Examples

iex> weights = %{delete: 10, insert: 0.1, replace: 1}
iex> TheFuzz.Similarity.WeightedLevenshtein.compare("book", "back", weights)
2
iex> weights = %{delete: 10, insert: 1, replace: 1}
iex> TheFuzz.Similarity.WeightedLevenshtein.compare("clms blvd", "columbus boulevard", weights)
9
Source