String.EditDistance

Functions for working with Levenshtein distance on Strings.

The Levenshtein distance can be used as a metric for how similar two Strings 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 Strings.

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.