[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hunspell for Japanese
From: |
Eli Zaretskii |
Subject: |
Re: Hunspell for Japanese |
Date: |
Sat, 17 Feb 2018 17:18:23 +0200 |
> From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
> Date: Sat, 17 Feb 2018 22:53:50 +0900
> Cc: 国広卓也 <tkk@misasa.okayama-u.ac.jp>
>
> I want to spellcheck English phrases that are mixed in Japanese
> phrases by `hunspell'. When I call M-x ispell-word, responses from `aspell'
> and
> `hunspell' differ. The difference results in how underlines are drawn in
> flyspell-mode. The `hunspell' gives many unnecessary underlines on Japanese
> phrases.
If your dictionary is for English, why do you expect flyspell-mode to
work correctly with words in another language? It can't do anything
sensible with such foreign words. The underlines flyspell-mode shows
in Japanese words when the dictionary is for English could be
anything; you should simply disregard any such underlines in
non-English words.
Can you tell why you pay attention to underlines in non-English words
in this situation?
> Is is possible to make `hunspell' behave like `aspell'?
They are very different programs, so they cannot behave the same.
> $ which hunspell
> /opt/local/bin/hunspell
> $ hunspell -D
> ...
> /opt/local/share/hunspell/en_US
> LOADED DICTIONARY:
> /opt/local/share/hunspell/en_US.aff
> /opt/local/share/hunspell/en_US.dic
> Hunspell 1.6.2
> $ Emacs -Q
> M-: (insert "Emacsは日本ではイーマックスと呼ばれる")
> C-a
> M-: (setq ispell-program-name "hunspell")
> M-x ispell-word
> X-b *Messages*
>
> > Starting new Ispell process hunspell with default dictionary...
> > Checking spelling of EMACSは日本語ではイーマックスと呼ばれる...
> > ispell-word: Ispell and its process have different character maps
I see the same message. It is caused by Hunspell somehow considering
the string "は日本語ではイーマックスと呼ばれる" as more than one word,
and it therefore returns 3 misspellings, which then trigger the above
cryptic error message.
But once again, you've set up flyspell-mode to work in English, so you
shouldn't pay attention to what it does with Japanese. For starters,
I believe the encoding Emacs uses is incorrect in that case, because
the en_US.aff file probably states that it wants a Latin-1 encoding,
not UTF-8. But even using UTF-8 will not help here, AFAIU.