How to disable built-in language check rules when running an HTTP server

I can start the standalone program and choose to disable certain rules categories and load my own rule xml file. I can choose to run this as a server in the options. However, this is only accessible to localhost clients. Then I turn to bring up a HTTP server instance with the commandline and a “public” argument. It works fine but I can’t disable the built-in rules.
How can I tell the server program to disable certain rule categories?
Many thanks!

You can use the --config option to specify a properties file. This file again can then point to a configuration file using rulesFile=/path/to/.languagetool.cfg. .languagetool.cfg can then contain information about rules that are turned off (you can simply use the configuration file that LT writes anyway when you make changes to the configuration in the user interface).

1 Like

Yes, it works. Thank you!

I am also trying to run --disable on the command line but the disabled rules still show up (LT version 3.4).

Where can I see docs or an example of .languagetool.cfg?

Also, are the docs outdated here? Command-Line Options - LanguageTool Wiki

Thanks

Could you post the whole command with its parameters that doesn’t work for you?

Where can I see docs or an example of .languagetool.cfg ?

You can just start and exit languagetool.org and the file should be created.

Also, are the docs outdated here? Command-Line Options - LanguageTool Wiki

I don’t think so. You can always call any LT command-line tool with --help to get its usage.

Could you post the whole command with its parameters that doesn’t work for you?

/usr/bin/java -cp /usr/local/languagetool/languagetool-server.jar org.languagetool.server.HTTPServer --config /etc/LTHTTPServer.properties --public --allow-origin \"*\" -v --disable=UPPERCASE_SENTENCE_START

The server can start and doesn’t error out, but the rule is not disabled.

If I do the following, it errors out (space between --disable and UPPERCASE_SENTENCE_START):

/usr/bin/java -cp /usr/local/languagetool/languagetool-server.jar org.languagetool.server.HTTPServer --config /etc/LTHTTPServer.properties --public --allow-origin \"*\" -v --disable UPPERCASE_SENTENCE_START

But --help doesn’t show the disable option.

Usage: HTTPServer [--config propertyFile] [--port|-p port] [--public]
  --config FILE  a Java property file (one key=value entry per line) with values for:
                 'mode' - 'LanguageTool' or 'AfterTheDeadline' for emulation of After the Deadline output (optional, experimental)
                 'afterTheDeadlineLanguage' - language code like 'en' or 'en-GB' (required if mode is 'AfterTheDeadline')
                 'maxTextLength' - maximum text length, longer texts will cause an error (optional)
                 'maxCheckTimeMillis' - maximum time in milliseconds allowed per check (optional)
                 'maxCheckThreads' - maximum number of threads working in parallel (optional)
                 'requestLimit' - maximum number of requests (optional)
                 'requestLimitPeriodInSeconds' - time period to which requestLimit applies (optional)
                 'languageModel' - a directory with '1grams', '2grams', '3grams' sub directories which contain a Lucene index
                  each with ngram occurrence counts; activates the confusion rule if supported (optional)
                 'maxWorkQueueSize' - reject request if request queue gets larger than this (optional)
                 'rulesFile' - a file containing rules configuration, such as .langugagetool.cfg (optional)
  --port, -p PRT port to bind to, defaults to 8081 if not specified
  --public       allow this server process to be connected from anywhere; if not set,
                 it can only be connected from the computer it was started on
  --allow-origin ORIGIN  set the Access-Control-Allow-Origin header in the HTTP response,
                         used for direct (non-proxy) JavaScript-based access from browsers;
                         example: --allow-origin "*"
  --verbose, -v  in case of exceptions, log the input text (up to 500 characters)

You can just start and exit languagetool.org and the file should be created.

I’m not quite sure how to do this. Do we go to the link and a the browser downloads a file?

Oh, I ran the standalone JAR, and the UI saved a file to ~/.languagetool.cfg (after clicking deactivate).

hmm I have the following in .languagetool.cfg

disabledRules.en-US=UPPERCASE_SENTENCE_START

And I’ve ran the server using adding --config /etc/LTHTTPServer.properties, and in LTHTTPServer.properties, I have:

maxCheckTimeMillis = 60000
rulesFile = /etc/.languagetool.cfg

But the rules are still not disabled.

That’s because it doesn’t exist for the server, only for the command line version. Disabling rules can be done per call only: LanguageTool HTTP API