Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oliverschloebe/google-spell-pspell

A PHP Pspell substitute for Google Spell Check XML API.
https://github.com/oliverschloebe/google-spell-pspell

google-spell-pspell php php-pspell-substitute pspell xml-structure

Last synced: 24 days ago
JSON representation

A PHP Pspell substitute for Google Spell Check XML API.

Awesome Lists containing this project

README

        

# google-spell-pspell

[![License](https://img.shields.io/packagist/l/oliverschloebe/google-spell-pspell.svg)](https://github.com/oliverschloebe/google-spell-pspell/blob/main/LICENSE)
[![Latest Stable Version](https://img.shields.io/packagist/v/oliverschloebe/google-spell-pspell.svg)](https://packagist.org/packages/oliverschloebe/google-spell-pspell)
[![Latest Version](https://img.shields.io/github/release/oliverschloebe/google-spell-pspell.svg?style=flat-square)](https://github.com/oliverschloebe/google-spell-pspell/releases)
[![Source Code](https://img.shields.io/badge/source-oliverschloebe/google--spell--pspell-blue.svg?style=flat-square)](https://github.com/oliverschloebe/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](http://productforums.google.com/forum/#!topic/chat/CPb0PYllbE8). This PHP class is a PHP Pspell substitute for Google Spell Check XML API using the same XML structure.

## Usage
```php
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:
```xml

This Th's Thus Th HS
test tat ST St st

```

... which you can use with your existing spell checking script such as GoogieSpell that was expecting XML structured data back from Google.

## Bugs/Suggestions

If you find a bug, or would like to contribute to the project please use the [Issue Tracker](https://github.com/AlphawolfWMP/google-spell-pspell/issues) over at my GitHub project page.

## Credits

Mad props to [Sabin Iacob (m0n5t3r)](http://m0n5t3r.info). Code basically from [here](http://plugins.svn.wordpress.org/ajax-spell-checker/trunk/service/spell-check-library.php), but I removed the Aspell and Google API parts and made it standalone-ready.