linuxnginxsystemdinit.dlanguagetool

LanguageTool Java app running as a systemd service. `--languagemodel` argument is ignored


I have downloaded the LanguageTool server. I have created a systemd process for the app to ensure that it can be easily managed and begins on startup:

Systemd

[Unit]
Description=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 '*'
StandardOutput=syslog+console+/var/log/languagetool.log
StandardError=syslog+console+/var/log/languagetool.log
User=www-data
Type=simple
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

The port is exposed via nginx as follows:

NGINX

server {
    listen 80;
    server_name my.domain.com;
    root /var/www/my.domain.com/public_html;

    index index.html;

    charset utf-8;

    access_log off;
    error_log  /var/log/nginx/my.domain.com-error.log error;

    location /v2/check {
        proxy_pass http://localhost:8081/v2/check;
    }

}

The --languagemodel option is ignored. If I type it improperly, then I see errors. The argument in the process file does not throw any errors, so it must be recognised by the system. The test n-grams displayed here do not return any results, though, so I know it's not loading properly.

I would like to know how to make the --languagemodel option work with systemd.


Solution

  • First, the capitalisation was important. The --languageModel option is only recognised by systemd when written in camel case.

    Second, the error was not any fault of my own, but resulted from a bug within the current version of LanguageTool. A fix is mentioned here. Using a snapshot of version 5.0 fixes the error. External n-grams are now used to generate results. The version 4.9.1 is due to be released within the next few days and contains a fix for the bug.