Implement fast Levenshtein distance algorithm in Delphi
$30-250 USD
Đang triển khai
Đã đăng vào hơn 11 năm trước
$30-250 USD
Thanh toán khi bàn giao
Your job is to write in Delphi a fast, case insensitive implementation of the Levenshtein distance algorithm. For example, you can use this implementation: [login to view URL]
I am using Levenshtein distance algorithm for Approximate String Matching. Therefore, the implementation should have an optional MaxDistance parameter, if set, the code would exit if the result cannot be smaller than MaxDistance.
The function should look like this: Function LevenshteinDist(str1, str2 : String; MaxDistance : Integer = -1) : integer;
For example:
LevenshteinDist("foobar", "FOOBAR") = 0
LevenshteinDist("foobar", "foobar") = 0
LevenshteinDist("foobar", "FOOBARx") = 1
LevenshteinDist("foobar", "FOOxBAR") = 1
LevenshteinDist("1234567890", "abcdefg", 3) = 3 (and the execution of the code should end, as soon as it is clear that the result will be >= 3)