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
.
@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
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.