LinuxCommandLibrary

enchant

a spellchecker

ORDERING FILE

Enchant uses global and per-user ordering files named enchant.ordering to decide which spelling provider to use for particular languages. The per-user file takes precedence.

The ordering file takes the form language_tag:<comma-separated list of spelling providers>. The language tag is typically an IETF BCP 47 language tag of the form COUNTRY_LANGUAGE. To see what dictionaries are available, run enchant-lsmod-2. ‘*’ is used to mean “use this ordering for all languages, unless instructed otherwise.” For example:

*:aspell,hunspell,nuspell
en:aspell,hunspell,nuspell
en_GB:hunspell,nuspell,aspell
fr:hunspell,nuspell,aspell

PERSONAL WORD LISTS

Personal word lists are simple plain text files with one word per line. Lines starting with a hash sign ‘#’ are ignored.

SHARING PERSONAL WORD LISTS BETWEEN SPELL-CHECKERS

It is possible, and usually safe, to share Enchant’s personal word lists with other spelling checkers that use the same format (note that other spell-checkers may not support comments!). The spell-checkers known to be compatible are Hunspell, Nuspell and Ispell. (Although Enchant does not support Ispell as a back-end, it’s still fine to share word lists with it.) Other spell-checkers supported by Enchant are either incompatible, or have no personal word list mechanism. There may well be yet other spell-checkers, unknown to Enchant, that use the same format.

Some applications use Hunspell or Nuspell, but store the personal word list under another name or in another location. Firefox is one example. Firefox also seems to reorder its word list when updating it; again, this is OK, as the result is still in the same format. Anonther example is Thunderbird.

To share word lists with Enchant, find the other spelling checker’s word list file, e.g. ~/.hunspell_fr_FR or ~/.config/nuspell/fr_FR, and merge it with the corresponding Enchant file, in this case ~/.config/enchant/fr_FR.dic. Use the following command, replacing ENCHANT-DICT and OTHER-DICT with the corresponding dictionary file names:

cat ENCHANT-DICT OTHER-DICT | sort -u > merged.txt

Take a look at merged.txt to check the merge has worked, then

mv merged.txt ENCHANT-DICT
rm OTHER-DICT
ln -s OTHER-DICT ENCHANT-DICT

to replace the other dictionary file with a link to the Enchant dictionary, again filling in the name of the dictionary files.

ENVIRONMENT

The following variables affect the behavior of Enchant:

ENCHANT_CONFIG_DIR

A directory in which Enchant should look for configuration files. See below.

G_MESSAGES_DEBUG

Enchant uses GLib's log functions, with the domain libenchant, to output messages useful for debugging. Setting G_MESSAGES_DEBUG to libenchant will cause Enchant to output debugging messages to standard error. See the GLib documentation for more details.

FILES AND DIRECTORIES

Enchant looks in the following places for files, in decreasing order of precedence:

ENCHANT_CONFIG_DIR

(If the environment variable is set.)

XDG_CONFIG_HOME/enchant (non-Windows systems)

Default: ~/.config/enchant

CSIDL_LOCAL_APPDATA\enchant (Windows systems)

Default: C:\Documents and Settings\username\Local Settings\Application Data\enchant

DATADIR/enchant

(Or the equivalent location relative to the enchant library for a relocatable build.)

Dictionaries are looked for in a subdirectory with the same name as the provider; for example, DATADIR/enchant/hunspell and ~/.config/enchant/hunspell.

Some providers may also look in a standard system directory for their dictionaries; the hunspell provider can be configured to do so at build time.

SEE ALSO

enchant-2(1), enchant-lsmod-2(1)

AUTHOR

Written by Dom Lachowicz and Reuben Thomas.

Copied to clipboard