Custom Dictionary's and Adding Words

PHPSpellCheck offers many routes to add words the the spellchecker's vocabulary.

Where are "Add To Dictionary" Words Stored?

The "Add to Dictionary" Button in the spellchecker dialog ("Learn..." in the context menu ) adds words to the spellcehcker. By default, the words are stored in their browser cache - the server remains unaffected.

Using the SpellCheckButton or SpellAsYouType classes - you can modify this behaviour using the AddWordsToDictionary property.

AddWordsToDictionary (SpellCheckButton & SpellAsYouType)

  • Determines where words that users 'Add to Dictionary' will be stored.
  • "USER" saves to a local cookie in the user's browser cache - only 1 user is affected. DEFAULT
  • "SERVER" stores the words on a file on the server - all users share this central dictionary. To enable this feature you must edit "phpspellcheck/core/index.php and set $SaveToCentralDictionary = true; on line 10.
  • "NONE" disables the 'Add to Dictionary' feature and removed the button.

Add Additional Dictionaries

Dictionaries (.dic files) can be downloaded from The Dictionary Download Page. To Install - just Unzip and copy them into /phpspellcheck/dictionaries/.

  • To change the default dictionary - code like this: $mySpell->Language = "Espanol"
  • To choose multiple simultaneous dictionaries for multi-language documents, code like this: $mySpell->Language = "English (Canada),Francais"

Encode a New Dictionary

This Tutorial shows how to encode you own, new .dic file using PHP. You can also download our free dictionary encoder application for windows.

Add To The Custom Dictionary

The easiest way to add new words to the spellcheckers vocabulary is to add them into /phpspellcheck/dictionaries/custom.txt

  • Add one word per line
  • If you sort you words in alphabetical (ascii) order - performance will be improved.
  • You can add many words to this file - then of thousands if you like. Performance may drop if the file gets too large.

Add words from Code or SQL

Go to /phpspellcheck/core/settings/default-settings/php

  • Uncomment $spellcheckObject ->AddCustomDictionaryFromArray($array)
    • Pass this function call an array of words
    • You can populate this array easily from an SQL database query

Add Words from a URL

Go to /phpspellcheck/core/settings/default-settings.php

  • Uncomment $spellcheckObject -> LoadCustomDictionaryFromURL( $URL );
    • The URL should point to a file that of words in alphabetical order, 1 per line

Advanced Modification

The spellchecker runs on the PHPSPellCheck Class.

  • You have access to modify the spellchecker through: /phpspellcheck/core/settings/default-settings.php