Skip to content

roundcube/google-spell-pspell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-spell-pspell

A PHP Pspell substitute for Google Spell Check XML API. Pspell is required in order to work on your server.

Why?

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.

Usage

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.

Run in Docker

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

Bugs/Suggestions

If you find a bug, or would like to contribute to the project please use the Issue Tracker.

Credits

Mad props to Sabin Iacob (m0n5t3r). Code basically from here, but I removed the Aspell and Google API parts and made it standalone-ready.

About

A PHP Pspell substitute for Google Spell Check XML API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 95.6%
  • Dockerfile 4.4%