Akin.SorensenDice (Akin v0.1.6) View Source

Functions to calculate the Sorensen-Dice coefficient of two strings.

Link to this section Summary

Functions

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

Link to this section Functions

Link to this function

compare(corpus1, corpus2, opts \\ [])

View Source

Specs

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