如何编写可以弥补拼写错误的数据的MySQL搜索? [英] How can I write an MySQL search that can compensate for misspelled data?
问题描述
有什么方法可以编写可以弥补用户在拼写等方面的错误的MySQL搜索?
Is there any way to write an MySQL search that can compensate for user-errors in spelling and the like?
作为随机示例,有人可能会键入foo@gmial.com而不是foo@gmail.com.
As random examples, someone might type foo@gmial.com instead of foo@gmail.com.
即使是搜索字词方面的帮助,也有助于从Google提取相关数据.可以说,我不是在寻找搜索引擎,而是在为管理控制面板提供某种拼写帮助.
Even help with search terms to help pull up relevant data from Google will be helpful. I'm not looking for a search engine, per say, what I'm looking for is some kind of spelling aid for an administrative control panel.
推荐答案
您正在研究的主题称为模糊查找".要跳下来,这是一个大兔子洞,具体取决于您想要获得的精度.有多种方法,例如:
The topic you're delving into is called "Fuzzy Lookup". It's a big rabbit hole to jump down, depending on how precise you'd like to get. There are various methods, such as:
- soundex
- Damerau-Levenshtein距离
- Jaro-Winkler距离
- 手机
- 双耳机
一些要签出的参考文献:
Some references to check out:
- PHP/MySQL小规模模糊搜索
http://en.wikipedia.org/wiki/近似字符串匹配 - Levenshtein距离在mysql/fuzzy搜索中是否实现?
- PHP/MySQL small-scale fuzzy search
- http://en.wikipedia.org/wiki/Approximate_string_matching
- How do I do a fuzzy match of company names in MYSQL with PHP for auto-complete?
- Implementation of Levenshtein distance for mysql/fuzzy search?
这篇关于如何编写可以弥补拼写错误的数据的MySQL搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!