View Source Akin.SorensenDice (Akin v0.2.0)
Functions to calculate the Sorensen-Dice coefficient of two strings.
Summary
Functions
Calculates the Sorensen-Dice coefficient of two given strings with a specified ngram size passed as the third argument.
Functions
@spec compare( %Akin.Corpus{ list: term(), original: term(), set: term(), stems: term(), string: term() }, %Akin.Corpus{ list: term(), original: term(), set: term(), stems: term(), string: term() }, Keyword.t() ) :: float()
Calculates the Sorensen-Dice coefficient of two given strings with a specified ngram size passed as the third argument.
Examples
iex> Akin.SorensenDice.compare(%Akin.Corpus{string: "night"}, %Akin.Corpus{string: "nacht"}, [ngram_size: 1]) 0.6 iex> Akin.SorensenDice.compare(%Akin.Corpus{string: "night"}, %Akin.Corpus{string: "nacht"}, []) 0.25 iex> Akin.SorensenDice.compare(%Akin.Corpus{string: "night"}, %Akin.Corpus{string: "nacht"}, [ngram_size: 3]) 0.0