WebSpellChecker.net Wiki

Home

Custom Dictionary Installation Instructions

  1. Dictionary basic information
  2. Types of dictionaries used in WebSpellChecker
  3. Format of dictionaries
  4. Creating customer dictionary
  5. Configuring Application Server for using customer dictionary
    1. Location of customer dictionaries
    2. Customer dictionary settings file structure
    3. Managing customer dictionaries
  6. Adding customer dictionary to your Web application
  7. Appendix I. “Simple Steps to embed a custom dictionary”
  8. Appendix II. “How to add Additional Dictionary to WebSpellChecker.net application”

1. Dictionary basic information

WebSpellChecker's web interface consists of two parts: the user interface displayed in your Web browser and the server part, which produces the output for browser. When a spell checking request arrives, the server part contacts Application Server. Application Server breaks all the received text into individual words and checks each word separately using available dictionaries.

2. Types of dictionaries used in WebSpellChecker

There are three types of dictionaries used in WebSpellChecker:

  • Main dictionary
  • Customer dictionaries
  • User dictionaries

The main dictionary is a standard dictionary shipped with the engine. It contains a general vocabulary of supported languages.

Customer dictionaries are company-wide dictionaries intended to extend the vocabulary of the standard dictionary, and can be customized for particular user groups. For example, if you want to add Legal or Medical (available on www.webspellchecker.net), or your own dictionary to your Web application, you need to attach a corresponding customer dictionary.

3. Format of dictionaries

Application Server accepts dictionaries of two formats: textual and native.

A textual dictionary is stored in a text lexicon files (.tlx) and has a very simple structure: each line contains only one word (i.e. each word is followed by the carriage return character).

Note that the last line in the file must be empty, otherwise the last word won't be recognized by the dictionary.

A native dictionary is a compiled version of a textual dictionary (.clx). You can download the compiler here.

Compiling a dictionary into the native format will significantly improve the performance of Application Server when the number of words reaches several hundreds.

4. Creating a customer dictionary

For the 16 default languages


The <language_ID> variable and full list of the languages which are supported by default can be found here.

To create a customer dictionary open a text editor and create your word list. The content of the word list should be sorted in alphabetical order. Please note that word list should be in ANSI (Latin1 1252, Greek 1253) encoding. If you have some difficulties with it you can use iconv utility in Linux or Notepad++ in Windows in order to convert your dictionary from Unicode charset to ANSI (Latin1 1252, Greek 1253). Once the word list is stored please place in the same folder as AppServerX.exe. Then please follow the steps below:

For Windows:

  • In command line go to “WebSpellChecker_installation_path\AppServer\” folder
  • Execute:
     AppServerX.exe -compileCustDict <source_file> <language_ID> 

For Linux:

  • In command line go to “WebSpellChecker_installation_path\AppServer\” folder
  • Execute:
    ./AppServerX -compileCustDict <source_file> <language_ID>

The new compiled Custom Dictionary will be placed into the “WebSpellChecker_installation_path\AppServer\CustDict\” folder . Please note that CustomerDb.xml will be updated automatically with new Custom Dictionary.

For the 137 additional languages


The full list of additional languages available here

How to use custom dictionaries with Enchant engine

1. Create word list. Each word should be located on a new line. Save file in UTF-8 format with usual .txt extension.

2. Copy file to [your_installation_path]\WebSpellChecker\AppServer\CustDict directory (by default). Also you can use other directory if you will specify it's path into <CustDictSubdir> tag in AppServerX.xml.

3. Open [your_installation_path]\WebSpellChecker\AppServer\CustomerDb.xml file.
4. Add new tag, specify DicId, FileName, Description and LangShortName for created custom dictionary.

<CustomerDb>
	 <Dictionary DicId="Unique_ID_Here">
	 	<LangShortName>lang_short_code_here</LangShortName>
		<FileName>dict_name_here.txt</FileName>
		<Description>My Custom Dictionary</Description>
	 </Dictionary>
 </CustomerDb>

4. Restart AppServer.
5. Refer to newly created custom dictionary by defined unique ID in CustomerDb.xml

5. Adding a customer dictionary to your Web application

The HTML page that invokes WSC or SCAYT includes the engine just like it does with a usual external script.
Since you need to pass additional parameters to the engine, you will need to assign an array of custom dictionary names/IDs to the appropriate property.

Please find Custom Dictionary initialization scheme for SCAYT and WSC plug-ins and standalone controls:

SCAYT plugin for CKEditor:

CKEDITOR.config.scayt_customDictionaryIds = "ID1, ID2";

WSC plgin for CKEditor:

CKEDITOR.config.wsc_customDictionaryIds = "ID1, ID2";

SCAYT plugin for TinyMCE:

scayt_custom_dic_ids: "ID1, ID2",

WSC plugin for TinyMCE:

wsc_customDictionaryName : ['ID1','ID2'],

SCAYT control for Textarea:

scaytConfig.customDictionaryIds = ['ID1','ID2'];

WSC control for Textarea:

customDictionaryName: ['ID1','ID2'],

Example: This is how it must look on your page for a WSC Textarea solution:

<script type="text/javascript">
     //<!--
         …
         doSpell({
             ctrl:"myEditor",
             lang:"en_US",
             customDictionaryName:["1","3001"]
         });
         …
     <//-->
 </script>

In the example above, we have attached custom dictionaries 1 and 3001.

6. Appendix I. "Simple Steps to embed a custom dictionary"

Check whether AppServerX.xml contains the Customer Dictionary-related elements

 <DSN>CustomerDb.xml</DSN>
 <CustDictSubdir>CustDict</CustDictSubdir>

Create a directory for your Customer dictionary. On Windows Platform, it is <WebSpellCheckerProgramFolder>\AppServer\CustDict\

Put your dictionary file(s) into the Customer Dictionary directory. On Windows Platform, <WebSpellCheckerProgramFolder>\AppServer\CustDict\

Create a CustomerDB.xml file in the root directory of Application Server. On Windows Platform, it is <WebSpellCheckerProgramFolder>\AppServer\. Put the following content into this file:

<CustomerDb>
	 <Dictionary DicId="1">
	 	<LangShortName>am</LangShortName>
		<FileName>dict_file.tlx</FileName>
		<FileName>dict_file.clx</FileName>
		<Description>My Custom Dictionary</Description>
	 </Dictionary>
 </CustomerDb>

Add a “customDictionaryName” property for the WebSpellChecker initialization object.

For a WSC solution:

 doSpell({
     ctrl:"myEditor",
     lang:"en_US",
     customDictionaryName:["1","3001"]
 });

Reload the page and test whether the words from your dictionary are not marked as errant.

7. Appendix II. "How to add Additional Dictionary to WebSpellChecker.net application"

Please review the instruction.

Contact Support Team

Leave a message for WebSpellChecker Technical Support