The PHP Spell Check Settings File


The settings file allows developers to fine tune the behavior of the spellchecker engine behind the SpellCheckButton and SpellAsYouType user interfaces.

Settings in this file are at server level - and so cannot be accessed though the usual APIs for security reasons.

Finding Your Settings File

The settings file is located at /phpspellcheck/core/settings/default-settings.php

  • The settings file is written in PHP Code
  • The settings file is well commented
  • The file should be modified with reference to the PHP Spell Check Server-Side Class
  • Care should be taken when modifying this file - as it may affect or stop the function of your spellcheckers.

Creating A New Settings File

  1. Duplicate '/phpspellcheck/core/settings/default-settings.php
  2. Rename to my-settings.php
  3. In your SpellCheckButton and SpellAsYouType implementations set the SettingsFile property to 'my-settings'

Editing The Settings File

Registration

This allows you to apply a professional Live-Spell License Key.

  • $spellcheckObject -> LicenceKey="TRIAL";
Basic Settings

This allows you to change the default values of basic spellchecking settings $spellcheckObject -> IgnoreAllCaps = false; $spellcheckObject -> IgnoreNumeric = false; $spellcheckObject -> CaseSensitive = true;

Basic Settings

This allows you to change the default values of basic spellchecking settings

  • $spellcheckObject -> IgnoreAllCaps = false;
  • $spellcheckObject -> IgnoreNumeric = false;
  • $spellcheckObject -> CaseSensitive = true;
Suggestion Tolerance

Set the tollerance of the spellchecker to 'unlikely' suggestions. 0=few suggestions ... 10=more suggestions

  • $spellcheckObject -> SuggestionTollerance = 1.5;
Suggestion Tolerance

Set the tollerance of the spellchecker to 'unlikely' suggestions. 0=few suggestions ... 10=more suggestions

  • $spellcheckObject -> SuggestionTollerance = 1.5;
Dictionary Path

Set up the file path to the (.dic) dictionaries folder

  • $spellcheckObject -> DictionaryPath = ("../dictionaries/");
Custom Vocabulary

Add vocabulary to the spellchecker from a text file loaded from the DictionaryPath

  • $spellcheckObject -> LoadCustomDictionary("custom.txt");
    • All words in this file are added to the vocabulary. 1 word per ascii line.
  • $spellcheckObject -> LoadCustomDictionaryFromURL( $URL );
    • All words in this file (fetched as text) are added to the vocabulary. 1 word per ascii line. Useful for integration with other systems. May slow performance somewhat.
  • $spellcheckObject ->AddCustomDictionaryFromArray($array) // This is great for SQL integration
    • All words in the array of strings are added to the vocabulary. This is great for SQL integration (populate the array from an SQL query)
Banned Words

Ban a list of words which will never be allowed as correct spellings. This is great for filtering profanity.*/

  • $spellcheckObject -> LoadCustomBannedWords("language-rules/banned-words.txt");

You can also add banned words from an array which you could easily populate from an SQL query

  • $spellcheckObject -> AddBannedWords(array("veryRudeWord"));

Read more about Banned Words and Strict Legal Spellchecking...

Enforced Corrections

$spellcheckObject -> LoadEnforcedCorrections("language-rules/enforced-corrections.txt");

    • The file is found relative to the DictionaryPath
    • The enforced corrections can be sued to manually override the spelling suggestions for any word.
Common Typing Mistakes

$spellcheckObject -> LoadCommonTypos("language-rules/common-mistakes.txt");

    • The file is found relative to the DictionaryPath
    • Load a list of common typing mistakes to fine tune the suggestion performance