A PHP Pspell substitute for Google Spell Check XML API. Pspell is required in order to work on your server.
Google obviously shut down their Spell checking API (www.google.com/tbproxy/spell) on July 9th 2013, see here. The spell-check-library.php
lib is a PHP Pspell substitute for Google Spell Check XML API using the same XML structure.
require_once('spell-check-library.php');
$content = "";
$options = array(
"lang" => 'en',
"maxSuggestions" => 10,
"customDict" => 0,
"charset" => 'utf-8'
);
$factory = new SpellChecker($options);
$spell = $factory->create(trim("Ths is a tst"));
header('Content-Type: text/xml; charset=UTF-8');
echo $spell->toXML();
Echoes Google-style XML like this:
<spellresult error="0" clipped="0" charschecked="12">
<c o="0" l="3" s="1">This Th's Thus Th HS</c>
<c o="9" l="3" s="1">test tat ST St st</c>
</spellresult>
... which you can use with your existing spell checking script such as GoogieSpell that was expecting XML structured data back from Google.
You can build a Docker image and run it using the included Dockerfile
:
$ docker build -t google-spell-pspell .
$ docker run -p 8080:80 -it google-spell-pspell
If you find a bug, or would like to contribute to the project please use the Issue Tracker.
Mad props to Sabin Iacob (m0n5t3r). Code basically from here, but I removed the Aspell and Google API parts and made it standalone-ready.