1

Duplicate of how does the google did you mean algorithm work

does anyone know how to write a word suggestion feature like Google's "did you mean?" feature? or know where I can find code samples.

Thanks

Community
  • 1
  • 1
  • possible duplicate of [How does the Google "Did you mean?" Algorithm work?](http://stackoverflow.com/questions/307291/how-does-the-google-did-you-mean-algorithm-work) – BalusC Oct 14 '11 at 05:10

1 Answers1

1

Peter Norvig (Google's head of research) has a simple one here which actually works pretty effectively: http://norvig.com/spell-correct.html

It's in python but is fairly simple to translate to other languages (note that there are some translations at the bottom of the page, but the C# version at least has a number of bugs in it and is very inefficient, so it would be worth doing the translation to whatever language you need yourself - it's also a good way to understand the code).

Greg Beech
  • 133,383
  • 43
  • 204
  • 250
  • You can use the C# translation at the bottom of the page as a start, but you'll need to fix a couple of bugs, and it can be speeded up by an order of magnitude. Unfortunately the version I wrote was done on commercial time so I'm not allowed to post it here. – Greg Beech Mar 06 '09 at 08:28
  • can you refering to this one? http://www.codegrunt.co.uk/?page=cSharp#norvigSpell Im not an expert in c#, could you point out where the bugs are or just what kind of bugs i should be looking for. thanks –  Mar 06 '09 at 12:14
  • I can't remember where the bugs are unfortunately as it was a good while ago I wrote our version, and now it's evolved to be very different. But IIRC they're fairly easy to spot because it just crashes. You could treat it as a good opportunity to get better at C# :-) – Greg Beech Mar 06 '09 at 17:33