View Source Akin.Levenshtein (Akin v0.2.0)
Compare two strings for their Levenshtein score.
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.
Functions
@spec compare(list(), list()) :: float()
@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()
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.