Akin.Levenshtein (Akin v0.1.7) View Source

Compare two strings for their Levenshtein score.

Link to this section Summary

Functions

Callback implementation for Akin.Task.compare/2.

The score is determined by finding the edit distance: the minimum number of single-character edits needed to change one word into the other. The distance is substracted from 1.0 and then divided by the longest length between the two strings. Result is rounded to the tenths.

Link to this section Functions

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

Callback implementation for Akin.Task.compare/2.

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

The score is determined by finding the edit distance: the minimum number of single-character edits needed to change one word into the other. The distance is substracted from 1.0 and then divided by the longest length between the two strings. Result is rounded to the tenths.