Using Personal Custom Dictionary with Aspell and Pspell

Lately I was building a spell checker with PHP and I wanted to use my own dictionary with only specific words. Pspell in PHP sounded like the easiest way, however, by default, Pspell uses Aspell’s dictionary.
In this post, I’m going to show you how to disable the default Aspell dictionary and use a custom made dictionary instead.


  • Root access to your Linux server.
  • Aspell already installed (This should be super easy on CentOS and Ubuntu)
  • Aspell language dictionary installed
  • PHP Pspell extension enabled


In Your Server’s Terminal

Let’s find where the default data directory is:

aspell config

Look for data-dir entry for the path, it’s usually /usr/lib64/aspell-0.60 on CentOS 7, and navigate to it

cd /usr/lib64/aspell-0.60

Create a new default wordlist, with at least 1 word

vim wordlist

Add 1 word, press “i” to write, and “wq” to exit back to command line

I’ll create a new master dictionary called en_techdev (English language)

aspell --lang=en create master ./en_techdev.rws < wordlist
vim en_techdev.multi

And add the following
add en_techdev.rws


aspell -d en_techdev.rws -l en  config

You will see the new master dictionary is our en_techdev.rws

You can use dump dicts to view your new dictionary

aspell dump dicts


In PHP, just use it as follows


$pspell_link = pspell_new(“en_techdev”);

You can add a new list to the dictionary

$pspell_config = pspell_config_create("en_TECHDEV");

pspell_config_personal($pspell_config, “/path/toYourWebsiteDir/pspell/en_techdev.pws”);

$pspell_link = pspell_new_config($pspell_config);

pspell_add_to_personal($pspell_link, “newWord”);

pspell_add_to_personal($pspell_link, “newWord2”);


Leave a Reply

Your email address will not be published. Required fields are marked *