Command-Line Options

LanguageTool can be started from the command line with java -jar languagetool-commandline.jar You need to specify the filename of the plain text file to be checked. More advanced options are documented here:

Option/Parameter Explanation
--help, --?, -h, -help Display usage message.
- Use standard input instead of a file.
--api Display LanguageTool output in XML API format - deprecated, please use the JSON API in server mode instead, which is usually faster, as it has no start up overhead.
--json Display LanguageTool output in JSON format - consider using the JSON API in server mode instead, which is usually faster, as it has no start up overhead.
-adl, --autoDetect Automatically detect language. Note that for languages with a variant, this will not detect the variant like "English (US)". Consequently, you'll not get spell checking for these languages.
-a, --apply Use the rules to correct the text directly rather than display suggestions. Note: rules that don't offer corrections are silently ignored. You might use this option to automatically edit the files. Caveat: you might want to select only some very reliable rules to avoid possible false positives.
-b Make single line break a paragraph break. By default, a paragraph break is introduced only after two line breaks. If your input is a list of unrelated lines that contain full sentences, you might want to use this parameter.
-b2, --bitext Check the text in bilingual mode. Use -m parameter to specify the source language, and -l to specify the target. LanguageTool expects the bilingual segments to be on a single line, where the source segment is separated from target with a tab.
-c, --encoding Input text encoding. All Java-recognized encodings are accepted.
-d, --disable Disable specified rules when checking. Rules are delimited with a comma and without spaces after the comma. Note: you cannot specify both enabled and disabled rules at the same time.
-e, --enable Enable only specified rules, delimited with a comma and without spaces after the comma. Note: you cannot specify both enabled and disabled rules at the same time.
-eo, --enabledonly Disable all rules except those specified in --enable. Note: you cannot specify both enabledonly and disabled rules at the same time.
--disablecategories Requires LT 3.3 or later - Disable all rules in the given categories. Use the ids of the categories, not their names. See -d for formatting.
--enablecategories Requires LT 3.3 or later - Enable all rules in the given categories. Use the ids of the categories, not their names. See -d for formatting.
-l, --language Text language as a character code (e.g. en for English). Note that you need to specify a variant (e.g. en-US) if you want spell checking to be active.
–-languagemodel A directory with '1grams'…'3grams' sub directories with Lucene indexes that contain ngram occurrence counts; activates the confusion rule if supported. See here.
–-list Print all available languages and exit.
-m, --mothertongue User's mother tongue as a language code (e.g. de-DE). Used for scanning for false friends.
-p, --profile Launch LanguageTool in the profiling mode for testing the speed of matching.
-r, --recursive Run LanguageTool recursively on a set of files.
-t, --taggeronly Use LanguageTool to tag the text. No check is executed.
-u, --list-unknown List words unknown to LanguageTool tagger. Useful for checking the coverage of the tagger. Note: you cannot specify --taggeronly and –-list-unknown at the same time. In the tagging mode, untagged words are visible anyway as untagged words, so the parameter makes no sense. Note that this is unrelated to whether LanguageTool detects a word as correct or incorrect with its spell checker.
-v, --verbose Verbose mode: display POS tags assigned by LanguageTool. The POS tags are output to stderr (you can pipe them to a file using 2> file).
-e, --enable Enable specified rules, delimited with a comma and without spaces after the comma. Note: you can specify both enabled and disabled rules at the same time.
--line-by-line work on file line by line (only for development, e.g. inside an IDE - error positions might not be correct, cross-paragraph rules might not work)

Examples

Run LanguageTool on a Polish text:

java -jar languagetool-commandline.jar -l pl polishfile.txt

In case of encoding problems under Windows you might need to specify the encoding like this:

java -Dfile.encoding=UTF-8 -jar languagetool-commandline.jar -l ru russian_file.txt

Tag UTF-8 encoded Polish text:

java -jar languagetool-commandline.jar -l pl -c UTF-8 -t polishfile.txt

Use verbose mode to see the tags to test rules interactively:

java -jar languagetool-commandline.jar -l en -v -b -

This mode of operation can be useful to see the tags immediately after inputting the text on the keyboard and see why a given rule doesn't work as expected.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License