views:

194

answers:

2
+1  Q: 

Word suggestion

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

A: 

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
thanksdo you guys know of any solution in c#
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
can you refering to this one?http://www.codegrunt.co.uk/?page=cSharp#norvigSpellIm 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
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