I created a cool spell checker at work today - using PHP and JavaScript. Unfortunately, I did it in company time - so it is not open source and I will not be able to give you the code. I used the PHP's pspell functions and created a UI similar to Gmail's spell check system.
There is a textarea into which the users will type some text. If the user clicks on the 'Spell Check' button, the page is submitted and the PHP will create a HTML string with the wrong words in red and underlined. It will also insert alternative suggestions for these words. Then JavaScript will take over. If the user clicks on a misspelled word, a small pop-up(DIV) will appear that has all the alternate spellings. If the user clicks on any one word, that word will be inserted in the place of the misspelled word. The final result has a very smooth effect - this is a code I am very proud of.
Some day I will create a open source script for the same - I will use the ajax framework to make the transactions even smoother. The only problem is TIME.
0 Comments:
Post a Comment