There are many problems which may occur with a web-site, however there is one which is far more common than any other. This is of course bad spelling. We find spelling mistakes on all sorts of sites, even professional and corporate sites which are doubtless maintained by trained copyrighters. Spell checking a web-site is notoriously difficult, as well as a tiresome exercise. Therefore, I introduce SprySpell to ease this burden.

Introduction

Spelling mistakes are common in web-sites, as they can easily 'slip though the net' of copyrighting and production tests. However when they do find their way onto your web-site it can give a distinctly unprofessional impression to your visitor, particularly if the mistake is in a prominent page or section heading. With Content Management Systems now common place, this problem is becoming ever more acute as it is very easy to simply edit a page and press the 'Edit' button. Ideally your CMS will have a spell checker built in, or perhaps you are copying and pasting from a word processor, helping you to catch these errors in pre-production. Unfortunately this is not always the case and catching errors once published is difficult.

To help solve this problem, SprySpell is now available, which will scan through any web-page you give it and check for errors. Rather that just outputting a boring list of errors, SprySpell will present the page you as would would expect to see it rendered in your web-browser, with any errors it caught highlighted and correction suggestions available. After selecting the corrections you want, you can then preview the page with the corrections made before re-publishing the page.

Usage

Using SprySpell is a simple as typing in the URL of the page you wish to spell check. SprySpell is freely available for you to use from this site:

When you click the 'spell check' button, SprySpell will present you with the target web-page, exactly as you would expect to see it in your web-browser, with two minor differences: words SprySpell did not recognise are highlighted and a SprySpell information bar is at the top of the page. As you roll over the highlighted words a selection box will appear which allows you to select a word from a suggestions list. To replace a word simply click on the word you wish to select.

Once you have replaced all the words you wish to correct, to preview the page simply click on the 'Correct' button in the SprySpell information bar. This will re-render your page as normal without the SprySpell correction utilities, but with your spelling corrected.

SprySpell can also be used as a more traditional spell checker for checking blocks of text. To use this functionality click the 'local text' tab on SprySpell.com, then enter the text you want to spell check into the input box on the page and click the 'spell check' button. The usage of this spell checking is exactly the same as when checking a web-page, as described above.

The following screen capture shows a Design Observer page being checked by SprySpell.

Methodology

SprySpell works by initially utilising cURL to pull the HTML of the target web-page off it's host server. This source code is then parsed by a PHP script which converts all URLs in to absolute links. The reason for this, of course, is that the web-browser will believe the web-page is hosted on spryspell.com, and that any media files which are linked relatively will also be available there. Converting the links to absolute terms, using the original URL from the request as a base, over comes this problem. Images, hyper-links (A tags), media-links (LINK tag) and CSS @import statements are all treated in this manner to try and maintain the look and feel of original page.

Once the HTML link information has been modified, additional HTML and JavaScript are injected into the file, providing the behaviour and style definitions that SprySpell uses to operate it's User Interface. Finally the SprySpell engine will parse though the HTML looking for text nodes. For each node that is found, and each word that is then found inside the node, it is parsed by the aspell spell checking engine using it's PHP API. This information is then passed on to JavaScript to be presented in the UI.

Future work

The obvious extension SprySpell lends itself to is having custom dictionaries. This would involve a registration and log-in system for each user so that dictionaries don't overlap. This would also allow customisation of the base dictionary that SprySpell uses. Currently SprySpell will always use the aspell UK dictionary, but preferences control would allow you to select, English US, French and so on as required.

Another expansion, utilising the log-in system, would be to allow SprySpell to upload the corrected HTML to the your own server using FTP. The problem with this is it doesn't take account of any back-end processing. This may seriously damage any CMS or PHP code etc embedded into the source file. I do have a prototype version of SprySpell which does exactly this, and works perfectly with simple HTML files. Similarly SprySpell can readily be integrated with SpryPanel.

If you have any suggestions for future enhancements or comments about SprySpell, please get in touch with me! It would be great to hear from you.

Article image

Elsewhere on the web