Back to LanguageTool Homepage - Privacy - Imprint

How to optimize memory use?

Currently we only need German and English. Does it help to remove xml files or classes or add some config to reduce memory given that I don’t need all of the other languages atm?

Are there other things that can be done to reduce memory use by disabling specific features?

As long as you don’t check texts in these languages, they shouldn’t cause much overhead.

especially on shorter texts LT does a good job but I recently stumbled over the fact that “string” is detected as italian

curl -X POST --header ‘Content-Type: application/x-www-form-urlencoded’ --header ‘Accept: application/json’ -d ‘text=string&language=auto&enabledOnly=false’ ‘https://api.languagetoolplus.com/v2/check

so I am not sure if this is really a viable approach.

You can send preferredLanguages=de,en as another parameter to improve language detection for short texts.

I am using “de-DE,en-GB” already but it still detects Italian for “string”.

You cannot use language variants with the preferredLanguages parameter. If you try, you should get: Internal Error: preferredLanguages may only contain language codes without variants (e.g. 'en', but not 'en-US'): [de-DE, en-GB]. Use 'preferredVariants' to specify variants.

ah sorry … I assumed you meant “preferredVariants” since “preferredLanguages” doesn’t appear on the swagger UI LanguageTool HTTP API

works like a charm!

but imho it would still be better to have a way to disable languages entirely to ensure that memory isn’t going to slowly climb. I guess we could monitor the memory use and restart if its reaches a certain limit.