Akin.Jaccard (Akin v0.1.7) View Source

Functions to calculate the Jaccard similarity between two strings

Link to this section Summary

Functions

Calculates the Jaccard similarity coefficient between two given strings with the specified ngram size

Link to this section Functions

Link to this function

compare(left, right, 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 Jaccard similarity coefficient between two given strings with the specified ngram size

Examples

iex> Akin.Jaccard.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 3]) 0.25 iex> Akin.Jaccard.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 1]) 0.5555555555555556