Skip to main content

HunspellDictionary Class

A Hunspell dictionary.

Namespace: DevExpress.Blazor.RichEdit.SpellCheck

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public class HunspellDictionary :
    GrammarBasedDictionary

Remarks

A Hunspell dictionary is an improved version of an ISpell dictionary and consists of a base words file and affix file. The base words file lists root words with applicable flags. A flag defines which affixes (prefixes and suffixes) can be added to a root, and the affix file lists all flags and their meanings. The Rich Text Editor combines these files to create a complete list of words.

Note

Assign a file provider to the FileProvider property so that the service can access dictionary files. The FileNotFoundException error occurs if you do not set the file provider, but add a dictionary.

A dictionary’s Culture property defines the dictionary’s culture. The Rich Text Editor checks spelling against all dictionaries when the component’s DocumentCulture property corresponds to an InvariantCulture. Otherwise, the Rich Text Editor uses only the dictionaries whose culture is invariant or matches the document’s culture.

The following code snippet adds a Hunspell dictionary to a project:

public void ConfigureServices(IServiceCollection services) {
    services.AddDevExpressBlazor().AddSpellCheck(opts => {
        opts.FileProvider = new PhysicalFileProvider(
            Path.Combine(Directory.GetCurrentDirectory(), "Data", "Dictionaries")
        );
        opts.Dictionaries.Add(new HunspellDictionary {
            DictionaryPath = "american.dic",
            GrammarPath = "english.aff",
            Culture = "en-US"
        });
    });
}

Refer to the following topic for more information: Spell Check.

Inheritance

See Also