View Source Akin.JaroWinkler (Akin v0.2.0)

Calculates the Jaro-Winkler Distance between two strings.

Summary

Functions

Callback implementation for Akin.Task.compare/2.

Calculates the Jaro-Winkler distance between two strings.

Modifies the prefix scale, which gives a more favorable rating to strings that match from the beginning.

Score the distance between two strings using String.jaro/2.

Functions

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

Callback implementation for Akin.Task.compare/2.

Link to this function

compare(corpus1, corpus2, 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 Jaro-Winkler distance between two strings.

Examples

iex> Akin.JaroWinkler.compare(%Akin.Corpus{string: "abc"}, %Akin.Corpus{string: ""}) 0.0 iex> Akin.JaroWinkler.compare(%Akin.Corpus{string: "abc"}, %Akin.Corpus{string: "xyz"}) 0.0 iex> Akin.JaroWinkler.compare(%Akin.Corpus{string: "compare me"}, %Akin.Corpus{string: "compare me"}) 1.0 iex> Akin.JaroWinkler.compare(%Akin.Corpus{string: "natural"}, %Akin.Corpus{string: "nothing"}) 0.5714285714285714

Link to this function

modify_prefix(left, right)

View Source

Modifies the prefix scale, which gives a more favorable rating to strings that match from the beginning.

Link to this function

modify_prefix(left, right, prefix_length, last_character)

View Source
@spec score(binary(), binary()) :: integer()
@spec score(binary(), binary()) :: integer()

Score the distance between two strings using String.jaro/2.