View Source Similarity.SorensenDice (Similarity v0.4.0)
String similarity comparison with the Sorensen-Dice algorithm.
Summary
Functions
Calculates the similarity between the left and right attributes, using Sorensen-Dice coefficient.
Functions
Calculates the similarity between the left and right attributes, using Sorensen-Dice coefficient.
Attribute can be a string, list or a MapSet.
Examples
iex> Similarity.SorensenDice.sorensen_dice("alma", "korte")
0.0
iex> Similarity.SorensenDice.sorensen_dice("alma", "alma")
1.0
iex> Similarity.SorensenDice.sorensen_dice("just letters", "letters just", ngram_size: 1)
1.0
iex> Similarity.SorensenDice.sorensen_dice("this that", "just that")
0.42857142857142855
iex> Similarity.SorensenDice.sorensen_dice([1, 2, 3], [1, 2, 3])
1.0
iex> Similarity.SorensenDice.sorensen_dice([1, 2, 3], [1, 2, 3, 4])
0.8571428571428571