Aspell and Pspell for PHP

From JacobAllred

Jump to: navigation, search

Contents

Overview

Aspell can be used in conjunction with PHP to add rudimentary or advanced spell-checking capabilities to your PHP scripts.

Usage

First you need to define which dictionary you want to use:

$dictionary = pspell_new('en');

After that, there are several useful functions you can use, such as pspell_suggest, which returns an array of potential correct spellings:

$wordArray = pspell_suggest($dictionary, 'monkee');

Installation

The pspell functions require that Aspell and one or more Aspell dictionaries are installed on the server.

Windows

  • Download and install the latest version of Aspell and a dictionary of your choice on the server.
  • Copy the Aspell DLL's to your PHP directory. These are probably called aspell-15.dll and pspell-15.dll, and are probably located at C:\Program Files\Aspell\Bin\
  • Add the extension to your php.ini file:
[PHP_PSPELL]
extension=php_pspell.dll
  • Restart Apache or IIS to reload php.ini
Personal tools