NB: These pages were mostly written in 2001 or so. The résumé dates are accurate but the code is aged and unlike whiskey, 8 year-old code doesn't usually taste better. For a look at my current skills and to see my CPAN modules, sample code, and code discussions, please see these pages instead: Perl resources and sample code and PangyreSoft.
Spell checking in forms with Perl & JavaScript
Social links
View Ashley Pond V's profile on LinkedIn

Other pages
Update: There is a new bit of code I’ve put together to abstract some of this stuff. I haven’t written it up yet and it’s still just getting rounded out but it’s easy to use; check it if you’re inclined: CGI::Form::Spell.


I spell poorly. I have an English degree. The conclusion I want you to draw is not that English degrees make fine if uneconomical cage liners but that English is a difficult language to spell. I must note that being able to spell a word more than one way was once a sign of brightness. The Bard himself signed his name with different spellings.

As we talked about already the power of Perl and JavaScript are a great match. In this CGI we use Perl’s interface to Aspell (Text::Aspell) to do spell checking of a textarea in a form and then use JavaScript to let the user voluntarily substitute out words which really aren’t correct with a simple click.

You can use a few different spelling engines. The two that are common, well documented, and easily available with Perl are Ispell and Aspell. I have always used and enjoyed Ispell because it’s the default in Emacs. I recently discovered Aspell and I have to say it’s far superior at discerning what world you meant when you typed, for example, “diocsyribonewclayik.” Whether you guessed it or not, Aspell did, “deoxyribonucleic.”

So, we’ll use Aspell for our example, though the functional interface of the main Perl module for Ispell makes it slightly more straightforward to implement in complex scripts.



I’m sorry to report that Text::Aspell is not currently installed on this server and might never be and the Ispell implementation isn’t able to make proper suggestions. So you can’t demo this script here. If you have Aspell and Perl, you are more than welcome to copy the script and try it yourself.

It is now here: Perl/JavaScript spelling checker. Please note, that server is not a dedicated box so it will not be up 100% of the time. If you try it and get nothing, try again a bit later.

Here is the code without line numbers for easy copying.

Search these pages via Google
Text, original code, fonts, and graphics ©1990-2009 Ashley Pond V.