Language Tool is a nice tool for people who write a lot. You could use the tool simply via the browser extensions without an own server. The problem is that you send everything you write to the Language Tool servers, which may not be ideal for privacy reasons. Therefore it is better to create a local Language Tool server. This way all data stays local on your computer. After all its very easy to implement the server.
Requirements #
- Java JDK and JRE (on Arch its the jdk-openjdk 20.0.1.u9-3 and jre-openjdk 20.0.1.u9-3 package)
- Browser Extension (Firefox Chrome)
Download needed files #
First you need do download the Language Tool Desktop version for offline use from this site. On this site you find also further information and documentation. After you download the zip archive you need to unpack it to the folder where the server should be stored. For me its under /home/ximnoise/Development/languageTool. Your unpacked folder should look like that.
languageTool/
├── LanguageTool-6.0
│ ├── CHANGES.md
│ ├── CHANGES.txt
│ ├── COPYING.txt
│ ├── META-INF
│ ├── README.md
│ ├── languagetool-commandline.jar
│ ├── languagetool-server.jar
│ ├── languagetool.jar
│ ├── libs
│ ├── org
│ ├── testrules.bat
│ ├── testrules.sh
│ └── third-party-licenses
After you download the server files you need also the n-gram data to detect errors with words hat are often confused, like their and there. You can find the download on this site and additional information and documentation on this site. After you download the n-gram data unpack the archive and move it in the created languageTool folder. So that in the end it looks like this.
languageTool/
├── LanguageTool-6.0
│ ├── CHANGES.md
│ ├── CHANGES.txt
│ ├── COPYING.txt
│ ├── META-INF
│ ├── README.md
│ ├── languagetool-commandline.jar
│ ├── languagetool-server.jar
│ ├── languagetool.jar
│ ├── libs
│ ├── org
│ ├── testrules.bat
│ ├── testrules.sh
│ └── third-party-licenses
└── ngrams
├── de
└── en
Create config file #
After we download all needed files we need to create a config file inside the languageTool/LanguageTool-6.0 folder. The configuration file is to tell the server where the n-gram data are stored. So create a config.conf file with following content.
languageModel=/home/ximnoise/Development/languageTool/ngrams
Create systemd service #
After the last steps we can now put everything together and create a systemd service to start the server anytime we start our machine. To create this you need a languageTool.service file under etc/systemd/system/ with following content.
[Unit]
Description=Language Tool local server
[Service]
Type=simple
ExecStart=/usr/bin/java -Xmx1536M -cp /home/ximnoise/Development/languageTool/LanguageTool-6.0/languagetool-server.jar org.languagetool.server.HTTPServer --port 8081 --allow-origin --config /home/ximnoise/Development/languageTool/LanguageTool-6.0/config.conf
[Install]
WantedBy=multi-user.target
The absolute path /home/ximnoise/Development/languageTool/LanguageTool-6.0/languagetool-server.jar is the path to our server file and the absolute path /home/ximnoise/Development/languageTool/LanguageTool-6.0/config.conf is the path to our created config file.
After you create the systemd service execute the following command.
systemctl enable languageTool.service
systemctl start languageTool.service
To test if everything works we only need to restart our machine and after that the LanguageTool server should start automatically.
Connect extension with server #
The last step is to connect our browser extension with our local server. Visit the extension options by clicking the cog icon, then open “Experimental settings” and select “Local server” there you put http://localhost:8081/v2. Now you can go to a page where you want to write something and you should see an icon at the bottom right and typos should be underlined in red.