Akin.Overlap (Akin v0.1.7) View Source

Implements the Overlap Similarity Metric.

Link to this section Summary

Functions

Compares two values using the Overlap Similarity metric and returns the coefficient. It takes the ngram size as the third argument.

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()

Compares two values using the Overlap Similarity metric and returns the coefficient. It takes the ngram size as the third argument.

Examples

iex> Akin.Overlap.compare(%Akin.Corpus{string: "compare me"}, %Akin.Corpus{string: "to me"}, []) 0.5 iex> Akin.Overlap.compare(%Akin.Corpus{string: "compare me"}, %Akin.Corpus{string: "to me"}, [ngram_size: 1]) 0.8 iex> Akin.Overlap.compare(%Akin.Corpus{string: "or me"}, %Akin.Corpus{string: "me"}, [ngram_size: 1]) 1.0