Does anyone know of a MySQL implementation of the Damerau–Levenshtein distance algorithm as a stored procedure/function that takes a single specified string as a parameter a
There is an ongoing development in Github to modify Sean Collins code so it has UTF-8 support and is case-insensitive.
Example:
mysql> select damlevlim('camión', 'çamion', 6);
+--------------------------------------+
| damlevlim('camión', 'çamion', 6) |
+--------------------------------------+
| 0 |
+--------------------------------------+
1 row in set (0.00 sec)
This is specially useful when doing fuzzy matches.
mysql> select word,damlevlim(word, 'camion') as dist from wordslist where damlevlim(word, 'camion', 7)<1 limit 2;
+--------+------+
| word | dist |
+--------+------+
| camión | 0 |
| camios | 1 |
+--------+------+
2 row in set (0.00 sec)