Setting up dictionaries for Enchant
February 21st, 2008 by Eric AlbrightIn my last post, I gave some tips for getting started with Enchant but you really can’t get anywhere until you have properly configured the providers and installed some dictionaries.
ASpell
The ASpell provider for Enchant requires aspell-15.dll. The easiest way to get started with ASpell is to use the installer for ASpell and for dictionaries.
- Be sure you have the ASpell provider (you can list it with enchant-lsmod) libenchant_aspell.dll
- Download the installer and run it to install ASpell.
- Download a dictionary installer from here and run the installer.
- Verify that it has been installed correctly by running
enchant-lsmod.exe -list-dicts. You should see something like:en_US (aspell)but with the language code for the language you installed instead ofen_US - You can also test it using
enchant -d en_US -a(again using the language code for the language you installed). Then you can type words which are or aren’t in the dictionary and see suggestions when they aren’t.
It is possible to use ASpell by including the aspell-15.dll in the same directory as libenchant_aspell.dll or it can be somewhere in the path. If you install aspell using the Windows installer, it will write a registry entry that points to where it was installed and Enchant will use that to find the dependency.
MySpell/Hunspell (OpenOffice format)
Enchant doesn’t require any additional dependencies other than the MySpell provider for MySpell dictionaries but it does require you to copy the dictionary files to the right place.
- Be sure you have the MySpell provider (you can list it with enchant-lsmod) libenchant_myspell.dll
- Download a dictionary that you want: You can get any of the dictionaries from OpenOffice.org.
- Unzip (or otherwise uncompress the package) and copy the contents into
%APPDATA%\enchant\myspell(you may need to create theenchantandmyspelldirectories the first time).
%APPDATA%is shorthand for theC:\Users\<username>\AppData\Roaming\folder (Windows Vista) or theC:\Documents and Settings\<username>\Application Data\folder (Windows XP/2000). But you can type%APPDATA%in the explorer’s address bar and it will go to the right place. - Verify that it has been installed correctly by running
enchant-lsmod.exe -list-dicts. You should see something like:en_US (myspell)but with the language code for the language you installed instead ofen_US - You can also test it using
enchant -d en_US -a(again using the language code for the language you installed). Then you can type words which are or aren’t in the dictionary and see suggestions when they aren’t.
Note: if you install MySpell and ASpell dictionaries for the same language, the ASpell dictionaries will be used instead of the MySpell dictionaries (this can be changed but I’ll leave that for another post)
If you are feeling really adventurous and would like to create your own, you can see the directions here.
ISpell
Enchant’s Ispell provider also doesn’t have any dependencies (the dictionaries are read directly by Enchant).
- Be sure you have the ISpell provider (you can list it with enchant-lsmod) libenchant_ispell.dll
- Download a dictionary from here (at the bottom of the page).
- Unzip (or otherwise uncompress the package) and copy the contents into
%APPDATA%\enchant\ispell(you may need to create theenchantandispelldirectories the first time). - Verify that it has been installed correctly by running
enchant-lsmod.exe -list-dicts. You should see something like:en_US (ispell)but with the language code for the language you installed instead ofen_US - You can also test it using
enchant -d en_US -a(again using the language code for the language you installed). Then you can type words which are or aren’t in the dictionary and see suggestions when they aren’t.
Empty dictionaries
An easy way to get spell checking for a language that doesn’t have a dictionary, is to create an empty MySpell dictionary. First, decide on the language code to be used. (You should use the iso639 code or the ietf language tag, for our example we will use qaa, the first of the private use language codes, as the language code). There are two files that are required, the affix file, qaa.aff, and the dictionary file, qaa.dic. They should both be put in %APPDATA%\enchant\myspell.
The qaa.aff file should contain the following line:
SET UTF-8
The qaa.dic file should contain the following line (it’s a zero, the number of items in the dictionary):
0
Of course, you won’t have any items in your empty dictionary so all the words will be marked as misspelled. As you add items to the dictionary using Enchant, the words will be stored in %APPDATA%\enchant\qaa.dic.
Palaso » Blog Archive » Configuring where Enchant looks for files said,
February 23, 2008 @ 9:01 pm
[…] Home Palaso « Setting up dictionaries for Enchant […]