I run a small and simple webservice for spellchecking. The interface is in the REST style: simply pass a query string (GET) or an encoded set of values (POST). It handles several encoding types and has a few styles for the output. The paramaters are:
en. Currently
only english and its variants are supportedamerican. Sadly that's the only supported value at the momentutf-8. Valid values aretext. Valid values
are:http://hacks.atrus.org/spellcheck-ws/check.php
Text
Lines beginning with :# can be ignored. If they begin with
an !, they contain an error message. Otherwise, it's part
of a list of suggestions. Each list is preceded by the word it is
for. If there are no suggestions because a word is spelled correctly, it
is followed by # Correct. Multiple words are separated by a
line consisting entirely of #.
Sample output:
One word:
# smple sample simple sampler #Two words:
# ardvark aardvark aardvarks aardvark's # # shoes # Correct #An error:
! Error - an error ocurred while intializing pspell
Javascript
Up to three variables may be set:
word)
word = "smple" suggestions = [ "sample", "simple", "sampler" ]Two words:
suggestions = [
[ "ardvark",
[
"aardvark",
"aardvarks",
"aardvark's" ]
],
[ "shoes",
null ]
]
]
An error:
error = "an error ocurred while intializing pspell"
XML
The root element is words, unless an error occurs. It contains zero or more
word sub-elements. Each of them contains a
text element with the word that was spellchecked
and either an empty correct element or
suggestions, which contains zero or more
suggestion elements.
If an error occurs, then the only element returned is error
with an error message. Sample outputs:
A single word:
<?xml version="1.0" encoding="UTF-8"?>
<words>
<word>
<text>smple</text>
<suggestions>
<suggestion>sample</suggestion>
<suggestion>simple</suggestion>
<suggestion>sampler</suggestion>
</suggestions>
</word>
</words>
Two words:
<?xml version="1.0" encoding="UTF-8"?>
<words>
<word>
<text>ardvark</text>
<suggestions>
<suggestion>aardvark</suggestion>
<suggestion>aardvarks</suggestion>
<suggestion>aardvark's</suggestion>
</suggestions>
</word>
<word>
<text>shoes</text>
<correct/>
</word>
</words>
An error:
<error>an error ocurred while intializing pspell</error>
If you find a bug or would like to make a suggestion, please e-mail me.
View source. I know it's messy. This script is licensed under the GPL.