preferredVariants doesn't seem to work as expected

Hi,

Recently I noticed that my pylanguagetool CLI seems to be reporting far too few errors in texts. Especially spelling issues are never reported.

I now took a closer look at the HTTP requests I am making and compared them to the ones on the website (where it was working correctly) and could find the source of the issue.

As I am from Austria, I prefer the spellchecking to be set to de-AT when detecting German. So I simply set preferredVariants to it in the config file and forgot about it.

But it seems like adding the parameter breaks a lot of rules:

curl -d 'text=This is a sentence with an unkdsfsdfown word&language=auto&preferredVariants=de-AT' https://languagetool.lw1.at/v2/check

detects no spelling issue, while

curl -d 'text=This is a sentence with an unkdsfsdfown word&language=auto' https://languagetool.lw1.at/v2/check

correctly detects it.

If you want to, I can create a Github issue about this, but I first wanted to check if I was doing something wrong.

Your text is detected as English (en), but only the variants en-US, en-GB etc. come with spell checking. So you need to specify a variant for all the languages that need a variant to have spell checking enabled (that’s only German, English).

Indeed

curl -d 'text=This is a sentence with an unkdsfsdfown word&language=auto&preferredVariants=de-AT,en-GB' https://languagetool.lw1.at/v2/check

works.
Would it be possible to add this information to the description in LanguageTool HTTP API ?

Yes, I’ll add an explanation about that.

1 Like