Add Hunspell dictionaries to Spell Checker

Spell Checker for TinyMCE includes support for Hunspell dictionaries. Hunspell dictionaries can be obtained from various sources, but the files must be stored in a specific structure to work with TinyMCE Spell Checker. Tiny provides downloadable bundles that have the required structure.

To add Hunspell dictionaries to a self-hosted TinyMCE:

  1. Download the latest TinyMCE Enterprise package.

  2. Download the desired Hunspell dictionaries.

  3. Configure the TinyMCE spelling service to use the Hunspell dictionaries.

Downloadable Hunspell Bundles

Tiny provides two downloadable bundles of Hunspell dictionaries.

hunspell-dictionaries-approved.zip

Does not contain dictionaries licensed under:

hunspell-dictionaries-all.zip

This package contains all the Hunspell dictionaries that the spelling service supports. You will need to ensure that their license matches your requirements.

You can remove unwanted dictionaries and their associated directories, but the file structure must be respected. Hunspell dictionaries can be downloaded from other sources, but will need to be stored in the structure shown in Hunspell dictionary storage for Spell Checker.

Configuring the spelling service to use Hunspell dictionaries

The ephox.spelling.hunspell-dictionaries-path setting is used to define the location of the Hunspell dictionaries. When the setting is not provided, Hunspell dictionaries are not supported.

Requirements:

  • The directory containing the Hunspell dictionaries must conform to the file structure defined in Hunspell dictionary storage for Spell Checker.

  • The directory containing the Hunspell dictionaries must be on the same server machine (or docker container) as the java service.

Tiny recommends storing the Hunspell dictionaries in a similar location to the application.conf file. For example, if application.conf is in a directory called /opt/ephox, the Hunspell dictionaries should be stored in the subdirectory /opt/ephox/hunspell-dictionaries.

Example:

ephox {
  spelling {
    hunspell-dictionaries-path: "/opt/ephox/hunspell-dictionaries"
  }
}

Hunspell dictionary storage for Spell Checker

Each Hunspell dictionary comes in two files. The .dic file which is the list of words, and the .aff file which is a list of rules and other options. These rules tell Hunspell, for example, how to convert a word into its plural or possessive forms. These files should be named following the language tag definition described in RFC 5646, using "-" or "_" as separator.

There are two file structures available for storing Hunspell dictionaries.

Flat structure

├── af_ZA.aff
├── af_ZA.dic
├── af_ZA.license
├── da.aff
├── da.dic
├── da.license
├── de_DE.aff
├── de_DE.dic
├── de_DE.license
├── en_AU.aff
├── en_AU.dic
├── en_AU.license
├── en_CA.aff
├── en_CA.dic
├── en_CA.license
├── en_GB.aff
├── en_GB.dic
├── en_GB.license
├── en_medical.aff
├── en_medical.dic
├── en_medical.license
├── en_US.aff
├── en_US.dic
├── en_US.license
├── es.aff
├── es.dic
├── es.license
├── fr.aff
├── fr.dic
├── fr.license
├── hu.aff
├── hu.dic
├── hu.license
├── it_IT.aff
├── it_IT.dic
├── it_IT.license
├── mi_NZ.aff
├── mi_NZ.dic
├── mi_NZ.license
├── nb_NO.aff
├── nb_NO.dic
├── nb_NO.license
├── nl_NL.aff
├── nl_NL.dic
├── nl_NL.license
├── nn.aff
├── nn.dic
├── nn.license
├── pl.aff
├── pl.dic
├── pl.license
├── pt_BR.aff
├── pt_BR.dic
├── pt_BR.license
├── pt_PT.aff
├── pt_PT.dic
├── pt_PT.license
├── sv_FI.aff
│── sv_FI.dic
├── sv_FI.license
├── sv_SE.aff
├── sv_SE.dic
└── sv_SE.license

Nested structure

├── af_ZA
│   ├── af_ZA.aff
│   ├── af_ZA.dic
│   └── license
├── da
│   ├── da.aff
│   ├── da.dic
│   └── license
├── de_DE
│   ├── de_DE.aff
│   ├── de_DE.dic
│   └── license
├── en_AU
│   ├── en_AU.aff
│   ├── en_AU.dic
│   └── license
├── en_CA
│   ├── en_CA.aff
│   ├── en_CA.dic
│   └── license
├── en_GB
│   ├── en_GB.aff
│   ├── en_GB.dic
│   └── license
├── en_medical
│   ├── en_medical.aff
│   ├── en_medical.dic
│   └── license
├── en_US
│   ├── en_US.aff
│   ├── en_US.dic
│   └── license
├── es
│   ├── es.aff
│   ├── es.dic
│   └── license
├── fr
│   ├── fr.aff
│   ├── fr.dic
│   └── license
├── hu
│   ├── hu.aff
│   ├── hu.dic
│   └── license
├── it_IT
│   ├── it_IT.aff
│   ├── it_IT.dic
│   └── license
├── mi_NZ
│   ├── license
│   ├── mi_NZ.aff
│   └── mi_NZ.dic
├── nb_NO
│   ├── license
│   ├── nb_NO.aff
│   └── nb_NO.dic
├── nl_NL
│   ├── license
│   ├── nl_NL.aff
│   └── nl_NL.dic
├── nn
│   ├── license
│   ├── nn.aff
│   └── nn.dic
├── pl
│   ├── license
│   ├── pl.aff
│   └── pl.dic
├── pt_BR
│   ├── license
│   ├── pt_BR.aff
│   └── pt_BR.dic
├── pt_PT
│   ├── license
│   ├── pt_PT.aff
│   └── pt_PT.dic
├── sv_FI
│   ├── license
│   ├── sv_FI.aff
│   └── sv_FI.dic
└── sv_SE
    ├── license
    ├── sv_SE.aff
    └── sv_SE.dic

Both structures may be used at the same time. If you provide dictionary files for the same language tag in both ways, Spell Checker will try to load the nested dictionary files first. If they’re not correct, then flat structured files will be loaded.

Missing Dictionaries

Where a Hunspell dictionary has not been provided, the spelling service will fallback to the built-in dictionaries for supported languages. For a list of supported Spell Checker languages, see: Spell Checker plugin - Supported languages.