The suggestion prioritization mechanism is designed to allow the admins to influence and change the default behavior of how the corrections are generated and shown to end users. Using this mechanism, the admins can create a list of rules which will be used during the process of generating corrections.

Here is a list of use cases where the suggestion prioritization mechanism will come in handy:

Rules categories

There is a list of main categories that can be used to create your custom rules for the suggestion prioritization.

Category nameDescription
ANY_POSITIONAny position in a word
WORD_INITIALThe first letter in a word
FIRST_OR_SECONDThe first or the second letter in a word
MIDDLE_OF_THE_WORDNot the first and not the last letter in a word
END_OF_THE_WORDThe last letter in a word (end of a word)
ENTIRE_WORDThe entire word

Syntax and configuration File

All the rules should be written in a special *.ini configuration file. 

Configuration file

The configuration file for the suggestion prioritization mechanism must match the next requirements.

You can have more than one configuration file with rules for different languages. Also, you can reuse a single file with rules for a list of languages which might have the same rules (e.g. English dialects).

Syntax

The syntax of the configuration file with rules for the suggestion prioritization must follow the next requirements.

CATEGORY_NAME
[value 1] [space] [value 2]
[value 1] [space] [value 2]
...
CATEGORY_NAME
[value 1] [space] [value 2]
...
blank line

If you are using the ENTIRE_WORD rule, make sure that all words that you use are present in the language or custom dictionaries.

This is an example of configuration file syntax with two rules:

END_OF_THE_WORD
z s
ENTIRE_WORD
teh the

Getting started

Once a new configuration file with the rules is ready and placed in the [WebSpellChecker_Installation_Folder]/AppServer/ folder. The next step is to enable the suggestion prioritization mechanism in the AppServerX.xml file.

1. Stop AppServer.

2. Go to the [WebSpellChecker_Installation_Folder]/AppServer/ folder and open the AppServerX.xml file.

3. In the list of all available parameters for AppServer, locate the SuggestionsPrioritization (previously CustomSuggestionsPrioritization) tag which is responsible for the suggestion prioritization mechanism. By default, the tag is commented.

4. Uncomment the section with the CustomSuggestionsPrioritization tag and fill in the information in the sub-tags as follows:

...
<SuggestionsPrioritization>
     <PrioritizationEnable>true</PrioritizationEnable>
<!-- Rules for each language -->
     <PrioritizationLang>
     <LangId>en_US</LangId>
     <ConfigFile>suggestions_prioritization_rules_en_US.ini</ConfigFile>
     <AdvancedSearch>true</AdvancedSearch>
     </PrioritizationLang>
</SuggestionsPrioritization>
...

If you want to use the suggestion prioritization mechanism for several languages and have separate configuration files, you need to duplicate the PrioritizationLang tag (see example below). 

...
<SuggestionsPrioritization>   
     <PrioritizationEnable>true</PrioritizationEnable> 
      <!-- Rules for each language -->
     </PrioritizationLang>
        <LangId>en_US</LangId> 
        <ConfigFile>suggestions_prioritization_rules_en_US.ini</ConfigFile>
        <AdvancedSearch>true</AdvancedSearch>
     </PrioritizationLang>

     <PrioritizationLang>
         <LangId>ar_SA</LangId>
         <ConfigFile>suggestions_prioritization_rules_ar_SA.ini</ConfigFile>
         <AdvancedSearch>true</AdvancedSearch>
     </PrioritizationLang>
</SuggestionsPrioritization>
...

5. Once all the changes are done, save the file and start AppServer.