TheFuzz v0.5.0 TheFuzz.Similarity.WeightedLevenshtein View Source

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

Link to this section Summary

Functions

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

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

Link to this section Functions

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

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