Levenshtein algorithm in MySql and accented characters

送分小仙女□ 提交于 2019-12-24 14:30:36

问题


I use the Levenshtein plugin for MySQL from: http://samjlevy.com/2011/03/MySQL-levenshtein-and-damerau-levenshtein-udfs/

I'm trying a query like:

SELECT name FROM database WHERE levenshtein(name, 'testć')

the problem is that levenshtein function doesnt handle accented characters. I need levenshtein to recognize characters like "C" and "Ć" (and others accented) as the same. So i decided to replace all of it in MySQL, but cant find any function for that. Like:

SELECT name FROM database WHERE levenshtein(toAscii(name), toAscii('testć'))

I dont want to use something like REPLACE( REPLACE(name, "ś", "s"), "ć", "c" ); It may be slow and it looks horrible.

来源:https://stackoverflow.com/questions/10426732/levenshtein-algorithm-in-mysql-and-accented-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!