Back to LanguageTool Homepage - Privacy - Imprint

How to properly supply languagemodel argument in systemd

The documentation is a little confusing where it comes to explaining how to target the proper directory when passing a value to the --languagemodel argument. It could do with an example or two and there is no note regarding capitalisation.

I have downloaded the English n-grams, stored in the directory, mounted on an external volume: /mnt/languagetool-volume/languagetool-ngrams/en/

I have configured LanguageTool to run as a systemd process as follows:

[Unit]
Description=Manage LanguageTool Service

[Service]
WorkingDirectory=/opt/languagetool
ExecStart=/usr/bin/java -cp /usr/local/LangAnalysisApp/LangTool/LanguageTool-4.9/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --languageModel '/mnt/languagetool-volume/languagetool-ngrams/' --allow-origin '*'
User=jvmapps
Type=simple
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

When testing using curl and the suggested test sentence " I can’t remember how to go their.", no errors are shown.

I have tried the following alternate syntax, none of which works:

–languageModel ‘/mnt/languagetool-volume/languagetool-ngrams’
–languageModel /mnt/languagetool-volume/languagetool-ngrams/
–languageModel /mnt/languagetool-volume/languagetool-ngrams
–languagemodel ‘/mnt/languagetool-volume/languagetool-ngrams/’
–languagemodel ‘/mnt/languagetool-volume/languagetool-ngrams’
–languagemodel /mnt/languagetool-volume/languagetool-ngrams

Please can someone explain how I can load the external n-grams when running the .jar file via a systemd process?

Please see Sth wrong when I am useing ngram on the server.. If you specify the directory in a wrong way, you’d get an error message.

1 Like

Using the new snapshot has solved the issue without making any further changes. N-gram rules are now working.