Discussion:
[Aspell-user] Using more than one language
Linus Feiten
2016-07-05 13:09:53 UTC
Permalink
Hi,

I am using aspell to check my latex files before compilation!

aspell --lang=en_gb --mode=tex -c main.tex

Now, I am working on a text that includes passages in both English and
German, but I have not found any way to run aspell with actually two
langauges like:

aspell --lang=en_gb,de_de --mode=tex -c main.tex


I could of course manually add all the German words to my .aspell.en.pws
file. But I think, this is somewhat wrong...

Isn't there another way?

Thanks,
Linus
t***@dp.dm.unipi.it
2016-07-05 14:42:53 UTC
Permalink
Making aspell work with two languages is difficult, because different
languages have different rules to decide what is a word. For example,
in English "aaa'bbb" is one word, while in German it is two words
("aaa" and "bbb"). The only solution that I know requires to use
aspell in list mode, piping the output of "aspell list --lang=en" into
"aspell list --lang=de". The result is, more or less, the words that are
neither English nor German.

But the converse (first lang=de then lang=en) gives a different result
because of the differences on word rules: "isn't" (that would be
accepted by --lang=en) is parsed by lang=de as "isn" ("t" is
discarded, since words should have at least 2 letters) and listed as
bad, and is then rejected by lang=en too.

This might be solved with enchant, that forces a uniform word parsing
rule, depending only on unicode character class. In this way one may
also mix alphabets, e.g. English and Russian or Greek.

If moreover you don't want only to have the bad words listed, but also
to have suggestions of the correct spelling, the situation is even
more involved: if a word is rejected, do you want suggestions in
English or in German, or both? Or depending on context?

Carlo Traverso
Linus Feiten
2016-07-08 10:32:55 UTC
Permalink
Hi Carlo,

thanks for the quick reply. I understand now that what I asked for is
not that simple.

The ideal for me would be that one language (say German) is the "main
language" of the document, so I would want aspell to detect all words
not in the de_de standard dictionary and ask me how to correct them;
UNLESS the respective word is also found in the en_gb dictionary. If a
word is found in neither, I don't mind if the suggestions are always
from the "main language".

But as this is probably not possible, I will add the english passages to
my .aspell.de.pws file.

Or how does the piping work which you suggested?

Thanks, Linus
Post by t***@dp.dm.unipi.it
Making aspell work with two languages is difficult, because different
languages have different rules to decide what is a word. For example,
in English "aaa'bbb" is one word, while in German it is two words
("aaa" and "bbb"). The only solution that I know requires to use
aspell in list mode, piping the output of "aspell list --lang=en" into
"aspell list --lang=de". The result is, more or less, the words that are
neither English nor German.
But the converse (first lang=de then lang=en) gives a different result
because of the differences on word rules: "isn't" (that would be
accepted by --lang=en) is parsed by lang=de as "isn" ("t" is
discarded, since words should have at least 2 letters) and listed as
bad, and is then rejected by lang=en too.
This might be solved with enchant, that forces a uniform word parsing
rule, depending only on unicode character class. In this way one may
also mix alphabets, e.g. English and Russian or Greek.
If moreover you don't want only to have the bad words listed, but also
to have suggestions of the correct spelling, the situation is even
more involved: if a word is rejected, do you want suggestions in
English or in German, or both? Or depending on context?
Carlo Traverso
Loading...