String.EditDistance
Functions for working with Levenshtein distance on String
s.
The Levenshtein distance can be used as a metric for how similar two String
s are. We can use this to suggest alternatives
when the user has given us a value we don't recognize.
Based on code from wikipedia article on Levenshtein distance
calculate :
String -> String -> Int
Calculate the Levenshtein distance between two String
s.
findMostSimilar :
{ maxAmount : Int
, maxDistance : Int
, from : Array String
}
-> String
-> Array String
Given an Array
of String
, find the value that is most similar to the given String
.