TheFuzz.Similarity.DiceSorensen (TheFuzz v0.6.0)

View Source

This module contains functions to calculate the Sorensen-Dice coefficient of 2 given strings.

Summary

Functions

Calculates the Sorensen-Dice coefficient of two given strings with the ngram size set to a default value of 2.

Calculates the Sorensen-Dice coefficient of two given strings with a specified ngram size passed as the third argument.

Functions

compare(a, b)

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

compare(a, b, ngram_size)

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