Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Collapse]Spell Checker
   [Expand]Product Information
    Getting Started
   [Collapse]Fundamentals
     Product Class Structure
     Spell Check Algorithms
     Dictionaries
     Checking Spelling in Different Controls
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Dictionaries

The ASPxSpellChecker uses special Spell Check Algorithms which require a dictionary to provide the list of words and/or rules. At a minimum, one of the four dictionary types must be defined for ASPxSpellChecker. Therefore, to add spell-checking to your project, you need to:

  • Choose the most appropriate dictionary type (Simple, ISpell, OpenOffice or a Hunspell).
  • Add it to your application for every particular language (culture) you want to support.
  • Add a custom dictionary for every language, if you want to allow end-users to add custom words.

All dictionaries are added to the ASPxSpellChecker.Dictionaries collection. You can add multiple dictionaries of the same type to this collection. For example, you may add different dictionaries for different languages to a single ASPxSpellChecker, and then the ASPxSpellChecker chooses appropriate dictionaries according to its current ASPxSpellChecker.Culture.

Expanded Simple Dictionary

This dictionary type lists words in a plain text file where each line contains only one word. To use this dictionary, manually prepare a text file (or export any existing dictionary to a plain text file).

The following code demonstrates how to create the ASPxSpellCheckerDictionary dictionary at runtime. It also shows how to use an alphabet file containing all letters in your preferred language:

Expanded ISpell Dictionary

An ideal dictionary would contain all the words of a given language. However, it's much smaller and more effective to split the dictionary into several parts (depending on the language). For example, in several Indo-European languages, including English, words are derived from the base by adding affixes - prefixes or postfixes. So the size of the dictionary can be greatly reduced if the base words, affixes and the rules for adding affixes to base words are placed into separate files. The complete list of words could be built in-place, when necessary. This technique especially proves its effectiveness for synthetic languages (rich in verbal and inflective forms) - Lithuanian or Russian, for example.

The ISpell dictionary is based upon this approach. It includes base words and affixes. Physically it's represented by the Alphabet file - *.txt, the Affix file - *.aff, and the Base Words file - *.xlg or *.hash. (Note: SpellChecker doesn't provide support for compressed *.hash files but you may use *.xlg files).

ISpell dictionaries are primarily developed by enthusiasts all over the world, and you may freely find them for different languages on the Web. Such dictionaries can be found at ftp://ftp.gnu.org/gnu/aspell/dict/0index.html. Additionally, while developed by different individuals, each ISpell dictionary may be redistributed under its specific license agreement. Most of them are free.

The following code demonstrates how to create the ASPxSpellCheckerISpellDictionary dictionary at runtime:

Expanded Open Office Dictionary

The Open Office dictionary is similar to ISpell, since it also generates the entire word list based on the Affix file - *.aff, and the Base Words file - *.dic. But note that this standard provides different rules for the Affix file than ISpell, so you can't use the same Affix files for both dictionaries.

In general, Open Office dictionaries are word rich and contain less mistakes than ISpell since they are developed by more people. The dictionaries and affix files used are a part of the OpenOffice.org project and can be download from here: Dictionaries for International Ispell.

The following code demonstrates how to create the ASPxSpellCheckerOpenOfficeDictionary dictionary at runtime:

Expanded Hunspell Dictionary

Hunspell allows dictionaries to define complex rules for compound word usage and was designed for languages with rich morphology and complex word compounding or character encoding. Its advantages include morphological analysis, Unicode support and reduced memory usage.

Hunspell dictionaries are used in the OpenOffice, FireFox, and OpenSpell spell check engines. As such, you can easily download existing dictionaries and thus streamline your deployment.

Hunspell dictionary includes two files - the Affix file with grammar rules- *.aff, and the Base Words file - *.dic file. The SpellChecker component uses them to create a HunspellDictionary in the same manner as it does for the OpenOffice dictionaries described above. You can specify the HunspellDictionary.GrammarPath and the DictionaryBase.DictionaryPath, then use the DictionaryBase.Load method to load a dictionary. Or you can load both dictionary parts from streams via the HunspellDictionary.LoadFromStream method.

Expanded Custom Dictionary

Custom dictionaries are intended to store end-user additions (words that are considered by end-users as "correct"). For example, after a ASPxSpellChecker has a custom dictionary for the current Culture, an end-user is able to click on the Add to Dictionary button on the Check Spelling Form and add this word to the currently available custom dictionary. The other dictionary types don't support this feature.

A custom dictionary consists of a text file (you can start from an empty file, or add several words, each on a new line) and an alphabet file. An alphabet file lists language characters. The English alphabet file contains the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ".

The following code demonstrates how to create the ASPxSpellCheckerCustomDictionary dictionary at runtime:

Note

A custom dictionary is overwritten by ASPxSpellChecker every time a new word is added to it, or it's manually changed by an end-user. Therefore this file must not be set to read-only.

How would you rate this topic?​​​​​​​