Skip to main content

HunspellDictionary Class

A dictionary for the Hunspell spell checking algorithm.

Namespace: DevExpress.XtraSpellChecker

Assembly: DevExpress.SpellChecker.v24.2.Core.dll

Declaration

public class HunspellDictionary :
    DictionaryBase,
    ICloseWordsCalculatorFactory

The following members return HunspellDictionary objects:

Remarks

A hunspell spell-checking dictionary instance is created by loading two files: a dictionary file and an affix file. The dictionary file, specified by the DictionaryBase.DictionaryPath property, contains only the root forms of words with information about morphological affix classes to combine with the roots. The affix file, specified by the HunspellDictionary.GrammarPath property, contains lists of affixes along with their context restrictions and effects. The affix file also serves as a settings file for the dictionary, containing all meta-data and settings.

The DictionaryBase.Load method is used to load Hunspell dictionary from files. You can load it from two streams containing dictionary and grammar data by using the HunspellDictionary.LoadFromStream method.

Note

We bear no responsibility for the content and availability of Hunspell dictionaries and affix files, since they are part of Hunspellproject (for more information visit the Hunspell web site.

Example

The following code demonstrates how to create the HunspellDictionary dictionary at runtime.

using DevExpress.XtraSpellChecker;
using System;
using System.Globalization;
            spellChecker1.Dictionaries.Clear();

            HunspellDictionary hunspellDictionaryEnglish = new HunspellDictionary();
            hunspellDictionaryEnglish.DictionaryPath = @"Dictionaries\Hunspell\en_US\en_US.dic";
            hunspellDictionaryEnglish.GrammarPath = @"Dictionaries\Hunspell\en_US\en_US.aff";
            hunspellDictionaryEnglish.Culture = new CultureInfo("en-US");
            hunspellDictionaryEnglish.Load();
            spellChecker1.Dictionaries.Add(hunspellDictionaryEnglish);

Inheritance

Object
DictionaryBase
HunspellDictionary
See Also