Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wikipedia : How "Did you mean" works and how to exploit it?

I want to know how does the "Did you mean : ..." of Wikipedia works and if there's a way, like with the API, to use it? Because I want to get the corresponding page from my input but this one could include errors. Example . Is there a query that returns directly the suggestion?

Thank you for your help.

like image 987
Michaël Avatar asked Nov 01 '10 18:11

Michaël


2 Answers

(I am not sure of Wikipedia's implementation details, but this is one way to do it)
It probably uses a phonetic algorithm, such as Soundex and matches it against a precomputed database.
PHP offers some phonetic algorithms built in if you want to play with them.

like image 130
Reese Moore Avatar answered Oct 17 '22 21:10

Reese Moore


This comes under "information retrieval" in computer science. Lucene is the open source library implementing these concepts and could be the library you are looking for. For more details on information retrieval you can search Google. For specifics on how "Did you mean" can be implemented using Lucene, go through the below links

  • http://www.javacodegeeks.com/2010/05/did-you-mean-feature-lucene-spell.html
  • "Did you mean?" feature in Lucene.net
like image 2
Aravind Yarram Avatar answered Oct 17 '22 20:10

Aravind Yarram