2

hunspell-checking Greek text I create in Emacs is not working.

Notes:

  • I am aware of this post: Spell check with multiple dictionaries
  • Eventually, I want to use ispell with hunspell in Emacs, which is also currently not working, I guess due to the problem described below.

Let me show my setup so far:

I downloaded a Greek dictionary from this page, https://sourceforge.net/projects/orthos-spell/files/v.0.4.0./orthos-el_GR-0.4.0-87.oxt/download, and extracted and installed the 2 relevant files:

$ unzip -x orthos-el_GR-0.4.0-87.oxt dicts/el_GR.dic dicts/el_GR.aff          
$ sudo mv * /usr/share/hunspell/

$ hunspell -D
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
...
/usr/share/hunspell/el_GR
...
Hunspell 1.3.2

For testing on the command line, I copied and pasted a word from the dictionary /usr/share/hunspell/el_GR.dic. Spell checking works fine.

$ echo "άλφα" | hunspell -d el_GR 
Hunspell 1.3.2
*

Now to Emacs: First I set the input method to greek-babel.

M-x set-input-method greek-babel

Now I can type alfa (the I get by ' followed by a):

άλφα

But pasting this into the hunspell commandline call, the word alfa with this accented a is not recognized:

$ echo "άλφα" | hunspell -d el_GR 
Hunspell 1.3.2
& άλφα 1 0: άλφα

A quick test in python shows that the accented as are different characters:

$ python
Python 2.7.13 (default, Jan 03 2017, 17:41:54) [GCC] on linux2
> ['ά'], ['ά']
(['\xce\xac'], ['\xe1\xbd\xb1'])

What am I missing?

  • What character encoding are you using in Emacs? – DoMiNeLa10 Aug 4 '18 at 11:03
  • C-h v buffer-file-coding-system shows utf-8. – foobar Aug 4 '18 at 11:24
1

Disclaimer: I know very little about spellcheckers, Unicode, and Emacs input methods and encodings; the following is just my superficial hunch as a native Greek speaker.

Unicode defines different code points for (U+03AC GREEK SMALL LETTER ALPHA WITH TONOS) and the visually very similar, if not identical, ?ά (U+1F71 GREEK SMALL LETTER ALPHA WITH OXIA), as explained in the following articles:

The articles also explain the various historical reasons for this discrepancy/duality. The crux of the matter is that all three Classical Greek input methods in Emacs (greek-babel, greek-ibycus4, and greek-mizuochi) use the oxia variant, whereas the two Modern Greek input methods (greek and greek-postfix) use the more conventional tonos variant.

So my guess is that some part of your spellchecker stack fails to "fold" the characters with oxia and tonos as comprising the same word.

Unless you need to write polytonic Classical Greek, I recommend you use the monotonic Modern Greek input method greek, rather than greek-babel.

I'm not sure whether the relevant input methods could handle this better, e.g. by using the more conventional tonos variants together with combining characters for the other polytonic accents, but I might raise this question on the bug-gnu-emacs or emacs-devel mailing lists after looking into the subject a bit more (feel free to do so yourself in the meantime).

0

Basil above hit the spot! Thanks for the detailed explanation.

This solved the issue for me:

M-x set-input-method greek

I then consulted the input method docs with

M-x describe-input-method

to find, how to add the acute and diaeresis symbols to characters (: and ; keys).

The greek text is now perfectly real-time spell-checked through flyspell.

Next I'll implement programmatic dictionary switching.

Thanks again Dave

  • Note that, by default, toggle-input-method and set-input-method are bound to C-\ and C-x RET C-\ , respectively, and describe-input-method is bound to C-h I. You can also accept your own answer if your issue is solved. – Basil Aug 5 '18 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.