Implement smart search / Fuzzy string comparison

廉价感情. 提交于 2019-12-03 13:52:43
Dhaust

You can use Levenshtein distance combined with a 'tags' field on Suppliers in your database for 'smart search' style functionality.

It's pretty basic but works for well for cases such as 'Zack/Zach'.

Adding tags in your database allows you to handle situations where people may search for a supplier by their acronym or other colloquial name.

See How to calculate distance similarity measure of given 2 strings? and http://www.dotnetperls.com/levenshtein for implementation details.

Stefan Steiger

What you need is an indexed search with a phonetic analysis filter.

Lucene.NET offers just that.

http://lucene.apache.org/core/4_0_0/analyzers-phonetic/org/apache/lucene/analysis/phonetic/PhoneticFilterFactory.html

How to perform Phonetic and Aproximative search in Lucene.net

See here for the .NET version of Phonetix:
http://sourceforge.net/projects/phonetixnet/

Here some more info on how to implement it in C#:
lucene.net phonetic filter

You can also use a BeiderMorseEncoder, which is designed to handle many languages.

On the subject of finding similarly spelled words, why not using a fuzzy search instead ?
how to do fuzzy search in Lucene.net in asp.net?
Lucene.net Fuzzy Phrase Search

There are also a whole lot of string metrics functions that you could use via CLR-Stored-Procedure: http://anastasiosyal.com/post/2009/01/11/Beyond-SoundEx-Functions-for-Fuzzy-Searching-in-MS-SQL-Server

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