TheFuzz v0.5.0 TheFuzz.Similarity.DiceSorensen View Source
This module contains functions to calculate the Sorensen-Dice coefficient of 2 given strings.
Link to this section Summary
Functions
Calculates the Sorensen-Dice coefficient of two given strings with the ngram size set to a default value of 2.
Examples
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht")
0.25
iex> TheFuzz.Similarity.DiceSorensen.compare("context", "contact")
0.5
Calculates the Sorensen-Dice coefficient of two given strings with a specified ngram size passed as the third argument.
Examples
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 1)
0.6
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 2)
0.25
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 3)
0.0
Link to this section Functions
Link to this function
compare(a, b) View Source
Calculates the Sorensen-Dice coefficient of two given strings with the ngram size set to a default value of 2.
Examples
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht")
0.25
iex> TheFuzz.Similarity.DiceSorensen.compare("context", "contact")
0.5
Link to this function
compare(a, b, ngram_size) View Source
Calculates the Sorensen-Dice coefficient of two given strings with a specified ngram size passed as the third argument.
Examples
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 1)
0.6
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 2)
0.25
iex> TheFuzz.Similarity.DiceSorensen.compare("night", "nacht", 3)
0.0