On Sun, Jul 20, 2008 at 07:44:51PM +0800, [EMAIL PROTECTED] wrote:
> X-debbugs-cc: [EMAIL PROTECTED]
> Package: dictionaries-common
> Version: 0.98.10
> Severity: wishlist
> File: /usr/share/emacs/site-lisp/dictionaries-common/flyspell.el
>
> OK, my goal now is to have flyspell use the wamerican-huge dictionary.
>
> You see it is driving me nuts to have "fortuneteller", "ridgeline"
> etc. common words turn red in flyspell.
>
> OK, so having installed wamerican-huge, we now proceed to try and have
> flyspell use it. But there is a bug: no clear documentation how to!
It is either aspell or ispell who should be instructed to use
wamerican-huge. How to do this depends on the spellchecker, and IMHO the
simpler is to fully create a dictionary containing a hash for the huge
wordlist.
You can however do some hack to use (more or less efficiently) a wordlist
as personal dictionary. All examples with normal american-english (is what I
have here). Also, better use aspell, ispell will either be removed or its
priority lowered once lenny is released.
ispell
------
Using plain american-english along with ispell
$ ispell -w áàâäåÅéêèëñíìïîóòöôúùüûç -d american -p \
/usr/share/dict/american-english mytext.txt
(ispell american dict does not support non 7bit chars). This is a bit slow
on loading for the normal american wordlist, so I guess this will be much
slower for the huge one. You also cannot write to this personal dictionary
(and will be warned about this).
You can also put in a personal (writable) dictionary only the words
currently not in the normal dict,
$ cat /usr/share/dict/american-english | \
ispell -l -w áàâäåÅéêèëñíìïîóòöôúùüûç -d american > ~/.ispell.en-huge
and invoke ispell as
$ ispell -w áàâäåÅéêèëñíìïîóòöôúùüûç -d american \
-p ~/.ispell.en-huge mytext.txt
aspell
------
Although you can also use a personal dictionary for aspell, you cannot do
the above directly for aspell, because aspell expects a header in the
personal dictionary like
personal_ws-1.1 en 11
followed by the list of words. In the above 'en' is the two letter language
code, and 11 stands for the number of words (will be much more for the huge
dict)
You can also put in that personal dict only the words not in the original
dict, e.g., for the normal dict
$ cat /usr/share/dict/american-english | aspell list -d american | wc -l
1726
means there are 1726 new words here, so you can do
$ echo "personal_ws-1.1 en 1726" > ~/.aspell.en-huge.pws
$ cat /usr/share/dict/american-english | \
aspell list -d american >> ~/.aspell.en-huge.pws
and use it as
$ aspell check -d american -p ~/.aspell.en-huge.pws
both
----
Then you can create an emacs entry as already explained in
/usr/share/doc/dictionaries-common/README.emacs.gz, modifying the options
passed to the spellchecker as appropriate (as above). Note that this is the
only place dictionaries-common has to do tangentially with what you want.
In cases like yours creating specific hashes should be more efficient.
You can also set `ispell-personal-dictionary' to the desired value, e.g.,
with the newly created aspell personal dictionary,
(setq ispell-personal-dictionary "~/.aspell.en-huge.pws")
but this will affect all languages, so use with extreme care. Also, this will
only not need a new emacsen entry if using aspell.
> In flyspell.el, we see "a personal dictionary can be used by
> invoking `ispell-change-dictionary'"
This is wrong, `ispell-change-dictionary' changes the current dictionary,
not the current personal dictionary. Thanks for noticing, I will get it
modified upstream.
> Looking into flyspell-default-dictionary, we see it is all about
> strings, but no mention of paths. All I know is I want to use
> /usr/share/dict/american-english-huge.
You cannot use it directly instead of the hashes, only as a personal
dictionary or create a hash containing it.
> Wait, in /usr/share/doc/dictionaries-common/README.Debian we see
> select-default-ispell:
> select-default-wordlist:
> But indeed, these just mention american, which is already selected.
>
> Maybe I'm supposed to make some manual symlink.
>
> That would be the path to disaster, as a simple wish like "make
> flyspell use wamerican-huge" should be in some debconf menu somewhere.
No, this is to select the default ispell dict and wordlist, will only set
which dictionary (or wordlist) ispell (or look) will use when invoked
without specific options.
> Anyway, please document how to make flyspell use wamerican-huge.
>
> If it affects spell(1) etc. that would be fine too.
>
> /usr/bin/spell -D /usr/share/dict/american-english-huge movie_ideas.html
> /usr/bin/spell: /usr/share/dict/american-english-huge.hash: cannot open
>
> I see. I have to create a hash file or something.
>
> How inflexible that there is no mechanism to enjoy wamerican-huge
> beyond look(1) without getting complicated.
>
> P.S., "ringtone" is not in wamerican-huge.
wamerican-huge contains a lot of jargon and foreign words that can appear in
English texts. Its extensive use may consider good many words that are really
misspellings. Use with a lot of care.
Finally, I do not think an extensive documentation about the use of personal
dictionaries belong in dictionaries-common, but in the spellchecker
manpages. I may add a minor example of setting a personal dict in
dictionaries-common README.emacs, and of course fix
`ispell-change-dictionary' description in flyspell.el, and will close this
bug report at that time.
Best wishes,
--
Agustin
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]