Hunspell and OpenOffice Dictionaries
The dictionaries of TX Spell .NET are Hunspell dictionaries, the format of the spell checkers in OpenOffice and LibreOffice. They exist for more than 60 languages, most of them are free to use and to ship with your application, and Text Control tests them and offers the approved ones for download. US English comes with TX Spell .NET; every other language is a download away. Read on for what a dictionary consists of, which languages Text Control offers, and where the files go.
What a Hunspell Dictionary Is
A Hunspell dictionary is a pair of text files with the same name:
| File | Holds |
|---|---|
| .dic | The word list: the number of words in the first line, then one word per line, with optional flags that refer to the affix file, such as 0th/pt |
| .aff | The affix rules that build the forms of a word from its stem, such as plural or past forms, and settings: the encoding of the files in the SET line, for example SET UTF-8, and replacement rules for suggestions |
Because the forms of a word are built by rules, the word list stays small. TX Spell .NET loads the pair as an OpenOfficeDictionary. Words of your own go into a user dictionary, a plain word list with the extension .txd, which User Dictionaries describes.
US English Is Included
The NuGet packages and the setup of TX Spell .NET bring the US English dictionary, en_US.dic and en_US.aff, so English text is checked in a new project without any setup. What You Get Out of the Box lists the files and where they go.
Download More Languages
Text Control offers the tested dictionaries as ZIP archives, one per language or region, on the dictionary download page. Each archive is named dictionary.<locale>.zip, for example dictionary.de_DE.zip. Archives exist for about 40 languages, from Afrikaans to Vietnamese; Supported Languages lists them with the files each archive contains.
Arabic, Hebrew, Persian and Urdu are written from right to left; Right-to-Left Languages covers them.
What an Archive Contains
An archive holds a folder named after the locale, with the files already sorted into the folders TX Spell .NET reads. The German archive, for example, contains:
tx_spell_dictionary.de_DE/
Dictionaries/
de_DE_frami.aff
de_DE_frami.dic
README_de_DE_frami.txt
COPYING_GPLv2.txt
COPYING_GPLv3.txt
HyphenationLists/
hyph_de_DE.dic
README_hyph_de.txt
COPYING_GPLv2.txt
COPYING_GPLv3.txt
SynonymLists/
th_de_DE_v2.dat
th_de_DE_v2.idx
README_thesaurus.txt
COPYING_GPLv2.txt
COPYING_GPLv3.txt
- Dictionaries holds the spell checking dictionary with its license files. Every archive has it.
- HyphenationLists holds the hyphenation list of the language, where one exists; Hyphenation Lists describes them.
- SynonymLists holds the thesaurus, where one exists; Synonym Lists describes them.
The name of the dictionary file doesn't always match the locale: the German archives contain de_DE_frami.dic, de_AT_frami.dic and de_CH_frami.dic, and the Catalan archive ca.dic. The name is what you pass when you load a dictionary by name.
Install a Dictionary
- Download the archive of the language.
- Unzip it and copy the contents of its folders into the folders of the same name that TX Spell .NET reads: the .dic and .aff files into Dictionaries, and the others into HyphenationLists and SynonymLists.
- For a .NET project, put the files into folders of the project and set their Copy to Output Directory property, so that every build copies them next to the application, where the packaged English files are.
By default, TX Spell .NET reads the Dictionaries folder next to the application or, on the development machine, below the Assembly folder of the installation. Loading and Managing Dictionaries shows how to use another folder and how the spell checker chooses among the dictionaries it finds.
Check the License of Each Dictionary
The dictionaries are written and maintained by their own authors, and each comes with its own license, in the README and COPYING files next to it in the archive. Most use the LGPL, but not all: the German dictionaries are licensed under the GPL, version 2 or 3, the French dictionary under the Mozilla Public License 2.0, and the English word list under the license of its SCOWL source. Read the license files of the dictionaries you ship.
How TX Spell .NET Uses the Affix Rules
TX Spell .NET reads the rules of the .aff file for more than word forms:
Suggestions. Replacement rules, written
REPin the affix file, describe typical mistakes: a missing accent, an umlaut written as two letters, "ue" for "ü", or a phonetic spelling, "f" for "ph". TX Spell .NET considers them when it creates suggestions, so "Fone" gets "Phone" as its first suggestion, here in TX Text Control Words:
Word characters. The flags
WORDCHARS,BREAKandICONVdefine characters that belong to words, characters that are both part of a word and a delimiter, and characters that are read as another character. The same flags work at the start of a user dictionary, as User Dictionaries shows.
Next Steps
- Loading and Managing Dictionaries: load the downloaded dictionaries and choose which one is used.
- User Dictionaries: add words of your own.
- Multilingual Documents and Language Scopes: check texts in several languages at once.