I think instead of (similar to the I command)
it should be (similar to the A command)
:
A
Accept the word for the rest of this hunspell session.
Let's check the man
page again:
The -a option is intended to be used from other programs through a pipe.
In this mode, hunspell prints a one-line version identification message,
and then begins reading lines of input.
So, when in -a mode
, hunspell
session ends after reading and processing the last line of input. Furthermore,
When in the -a mode, hunspell will also accept lines of single words prefixed
with any of '*', '&', '@', '+', '-', '~', '#', '!', '%', ''', or '^'. A line
starting with '*' tells hunspell to insert the word into the user's dictionary
(similar to the I command)[........] A line prefixed with '#' will cause the
personal dictionary to be saved.
Prefixing a single word line with *
(note there should be no space between word and prefix) will add that word to the user's dictionary but only for the current hunspell
session, since, as per the man
page, only a line prefixed with #
will cause the personal dictionary to be saved (the on-disk file, that is). Hence running
echo "*goosfraba" | hunspell -a
does absolutely nothing. hunspell
adds goosfraba to the dictionary for this session then exits (no other lines to process). You have to add a second line prefixed with #
in order to save the recently added word(s):
echo -e "*goosfraba\n#" | hunspell -a
Let's see:
::spell-checking goosfraba:
echo -e "goosfraba" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
& goosfraba 1 0: goofball
& = Word
is not in the dictionary, there is one near miss: goofball.
::adding goosfraba to the dictionary then spell-checking during the same hunspell
session (two lines):
echo -e "*goosfraba\ngoosfraba" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
*
* = Word
is in the dictionary.
::spell-checking goosfraba again (new hunspell
session):
echo -e "goosfraba" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
& goosfraba 1 0: goofball
& = Again, word
is not in the dictionary (nothing was saved during the previous session)
::adding goosfraba to the dictionary and saving during the same hunspell
session (two lines):
echo -e "*goosfraba\n#" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
::spell-checking goosfraba again (new hunspell
session):
echo "goosfraba" | hunspell -a
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
*
* = Word
is in the dictionary.
Aspell Author Here.
As I said in an earlier answer, you can't just combine dictionaries from different languages and expect it to work. You need to create a new language that combines the features of the two original languages.
Fortunately for English and German this is fairly easy; however, the suggestion quality will suffer for English words since we will disable the use of soundslike lookup.
Install the aspell-en and the aspell-de dictionary package
Go to a empty directory to keep everything clean. Also to avoid any charset issues change the locale to "C" by setting LC_ALL=C
.
Dump the English and German dictionaries into plan wordlists
aspell dump master en > en.txt
aspell dump master de > de.txt
Combine en.dat and de.dat, which you can generally find in usr/lib/aspell
.
The English dictionary uses soundslike lookup but that won't with the German dictionary (due to the fact that it is English specific, and more importable it is incompatible with Affix compression) so we will disable it.
The English dictionary doesn't use affix compression but the German dictionary does so we will just use the affix file for the German dictionary. (This will avoid having to expand the German dictionary and thus increasing it size).
We will call the language qed, 'q' since very few languages start with q, 'e' for English, and 'g' for German. (The language name should generally be 2 to 3 letters, but aspell doesn't really care, so en-de or some other name might work, but a 2 or 3 letter name is guaranteed to work)
The file will be named qed.dat
and contain the following:
name qed
charset iso8859-1
special ' -*-
soundslike none
affix qed
affix-compress true
Copy de_affix.dat
into the current directory and rename it qed_affix.dat
.
Create the combined dictionary:
cat en.txt de.txt | aspell create master -l ./qed ./qed.rws
Create the file qed.multi
:
add qed.rws
Test the dictionary by using -d ./qed
. the ./
is needed to force aspell to search the current directory.
Install qed.dat
qed.rws
qed.multi
and qed_affix.dat
somewhere where aspell will find it. Please see the manual for info on how aspell searches for dictionary and language data files.
Done. Everything should work now. A more sophisticated solution will enable some form of soundslike lookup for better suggestion quality. But that requires special care when used with affix compression (see the Aspell manual for details). As an alternative the German dictionary can be expanded and the English soundlike lookup can be used, but that might not work so well on German words.
The case of combing English and German was easy because they both use the same charset (iso-8859-1) and because only one language used Affix compression. Combining other languages will take more work but it is possible once you know what you are doing. I spelled out the steps here in detail to give readers some idea of how Aspell works so a similar thing can be used for other language combinations.
If both languages use affix compression, either the affix files will need to be combined so there are no conflicting flags, or one of the dictionaries will need to be expanded.
If the two languages use a different 8-bit charset than a compatible charset that can support both languages we need to be used. If a standard one doesn't exist, than a new one can be created. To avoid confusion the wordlists should be converted to utf-8 and Aspell should be instructed to expect all input and output in utf-8 instead of the charset that is used internally, which for historical reasons is the default.
Best Answer
Thunderbird spellcheck can use hunspell dictionaries, you can load them by setting the environment variable
DICPATH
... hunspell dictionary can be edited with any text editor, by modifying thedic
files under/usr/share/hunspell
...export DICPATH=/usr/share/hunspell
Hunspell customisation and man/howto