Akin.Tversky (Akin v0.1.7) View Source

Functions to calculate the Tversky index between two strings.

Link to this section Summary

Functions

Calculates the Tversky index between two strings. Default alpha is 1 and beta is 1. ngram_size is a positive integer greater than 0 used to tokenize the strings

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()
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()
  },
  integer()
) :: float()

Calculates the Tversky index between two strings. Default alpha is 1 and beta is 1. ngram_size is a positive integer greater than 0 used to tokenize the strings

Examples

iex> Akin.Tversky.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 4]) 0.14285714285714285 iex> Akin.Tversky.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}) 0.3333333333333333 iex> Akin.Tversky.compare(%Akin.Corpus{string: "contact"}, %Akin.Corpus{string: "context"}, [ngram_size: 1]) 0.5555555555555556