views:

42

answers:

1

I am trying to get a spellchecker to check spelling in a text field as the user types. I am well aware that browsers such as firefox have this feature for textfields (but this requires a user to manually enable it in the right click menu.

The ideal script Im looking for would accept an id as a parameter, since the id for the field I want to be checked cannot change.

Thanks

A: 

My suggestion would to look at a predictive text tool, similar to the tag-finder that SO uses where you have a dictionary, and as a term is typed, you do some kind of AJAX-y lookup to see if they're typing correctly.

Adding a new word would be similar to adding new tags on SO - if the predicted word is not picked, add it to your dictionary.

I'm sure there are others who have done a similar task, though - and this suggestion might be harder to implement than in sounds in my head.

warren
Methinks much harder. I've actually done this before in python... requires you to compute word-distances and you to know the probability of that word occuring...and if you want to do a really good job you should look at surrounding words (bigrams ot trigrams)... and then you get into viterbi and hidden markov models... (it's all a bit of a haze). Best to find a premade script.
Mark
@Mark - all good points. I suppose the SO model works because the 'dictionary' is small, and it doesn't start doing a lookup until you've typed a couple characters.
warren
Well, SO is not doing spelling correction, which is completely different. Much easier to compute. Without spelling correction, you can filter out a whole bunch of entries immediately if they don't start with the same letters... in spelling correction you can't really rule anything out... at least not that easily.
Mark