View Source Akin.Ngram (Akin v0.2.0)

Functions to calculate the ngram distance between two given strings based on this paper

Summary

Functions

Calculates the ngram similarity between two given strings with a specified ngram size

Functions

Link to this function

compare(left, right, opts \\ [])

View Source
@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 ngram similarity between two given strings with a specified ngram size

Examples

iex> Akin.Ngram.compare(%Akin.Corpus{string: "night"}, %Akin.Corpus{string: "naght"}, [ngram_size: 3]) 0.3333333333333333 iex> Akin.Ngram.compare(%Akin.Corpus{string: "context"}, %Akin.Corpus{string: "contact"}, [ngram_size: 1]) 0.7142857142857143