Pspell Functions


The Pspell library adds a generic spell-checking interface to PHP. To use these functions, you need to install both the Aspell and Pspell libraries, which you can download from http://aspell.sourceforge.net and http://pspell.sourceforge.net, respectively.

When using Pspell, you will usually be working with one or both of two wordlists: the system wordlist, which is loaded from a central location, shared by all users on the system, and which you cannot modify; and the personal wordlist, which is stored for your own use and to which you can add your own words and/or spelling modifications.

Pspell dictionary files (PWLI files) are named according to the language, encoding, jargon, and module (explained in the list below). To determine the location of the system dictionaries, you can use the command pspell-config pkgdatadir. The naming scheme for PWLI files is as follows:

<language>[-[spelling][-jargon]]-<module>.pwli


The meanings of the parts of the name are:

  • language: The two-letter language code. Required.

  • spelling: The spelling preference to use within a given language; for instance, 'american', 'canadian', or 'british'. If this is left out of the name, two dashes must separate language and jargon. Optional.

  • jargon: Distinguishes between words having the same language and spelling; examples include 'medical' and 'xlg'. Optional.

  • module: The spelling module for which the list is intended; for instance, 'aspell' or 'ispell'. Required.



Examples of some of the dictionary filenames found on the author's system:

  • en-british-aspell.pwli

  • en-british-lrg-aspell.pwli

  • en-british-med-aspell.pwli

  • en-canadian-aspell.pwli



This extension is only available in versions of PHP greater than PHP 4.0.2.