Copyright | © 2016 Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov@openmailbox.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Levenshtein variants
levenshtein :: Text -> Text -> Natural Source #
Return Levenshtein distance between two Text
values. Classic
Levenshtein distance between two strings is minimal number of operations
necessary to transform one string into another. For Levenshtein distance
allowed operations are: deletion, insertion, and substitution.
See also: https://en.wikipedia.org/wiki/Levenshtein_distance.
levenshteinNorm :: Text -> Text -> Ratio Natural Source #
Return normalized Levenshtein distance between two Text
values.
Result is a non-negative rational number (represented as
), where 0 signifies no similarity between the strings, while 1
means exact match. The operation is virtually as fast as Ratio
Natural
levenshtein
.
See also: https://en.wikipedia.org/wiki/Levenshtein_distance.
damerauLevenshtein :: Text -> Text -> Natural Source #
Return Damerau-Levenshtein distance between two Text
values. The
function works like levenshtein
, but the collection of allowed
operations also includes transposition of two adjacent characters. The
function is about 20% slower than levenshtein
, but still pretty fast.
See also: https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance.
damerauLevenshteinNorm :: Text -> Text -> Ratio Natural Source #
Return normalized Damerau-Levenshtein distance between two Text
values. Result is a non-negative rational number (represented as
), where 0 signifies no similarity between the strings, while 1
means exact match. The operation is virtually as fast as
Ratio
Natural
damerauLevenshtein
.
See also: https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance.