Skip to content

LanguageTool (An Open Source alternative to Grammarly) in Docker on a Synology NAS

UpdateDate
New guide released12/12/2021

I was looking for a free and also more privacy focused version of Grammarly to help with improving these guides and my writing in general and discovered LanguageTool. It has a free tier as well as premium options. But the part that sold it for me is that it could be self-hosted meaning your data stays local, and its source is open.

In this guide I will take you through the steps of getting it setup in Docker on your Synology NAS.

This guide assumes you have already installed and have Docker running.

Performance

When the tool is doing its checks it is a read heavy operation, I found that if you are checking large amounts of text it can take longer when running off of a hard drive array. I would recommend having an SSD read cache which will speed up things considerably.

Folder Structure

Open up Filestation and create a folder within the docker share called ‘languagetool’

N-Gram Data

In order to make LanguageTool more functional you will want to download the n-grams’ data, this helps the tool detect spelling errors in context. What n-grams do is explained here.

Go to the download site below and download the data for your language, you can save the zip file to your computer, the English zip is around 8Gb.

https://languagetool.org/download/ngram-data/

Once the zip file has downloaded we need to upload it to our Docker share and unzip it.

Go back into Filestation and into the ‘languagetool’ folder we created, click on ‘Upload’ and upload the zip file.

Select Upload

You can see the progress in the top right side of DSM.

The progress displayed at the top right of DSM

Once the upload has been completed we need to unzip/extract the n-grams’ data, you do this by right-clicking on the zip file, selecting ‘Extract’ then ‘Extract Here’ from the sub menu. This will likely take a few minutes. The final extracted size for the files is around 16Gb.

After extraction, you should have a new subfolder called ‘en’ or the language code of the language you downloaded, you can delete the zip file if you wish.

Setting up the Container

Now we can look at getting the container set up, open up Docker and go into the ‘Registry’ tab.

Search for LanguageTool in the top right of the window, for this guide we will be using the container by erikvl87.

Click on Download and when asked to choose a tag, select ‘latest’

You can check the status of the download over on the ‘Image’ tab, it will take a few minutes depending on the speed of your internet connection.

Setting up the container

In Docker click on the ‘Image’ tab, in the list of your containers select the LanguageTool image and click on ‘Launch’

You will now see the initial setup screen, if you want to you can change the name of the container to something else.

You will also notice a Configure capabilities button — don’t change anything in here!

Next up we are going to click on the ‘Advanced Settings’ button, this will take you to a new window with a number of tabs which we are going to work through.

On the first tab enable ‘Auto Restart’ this will ensure LanguageTool will automatically start up whenever you reboot your NAS.

Volumes / Mounts

We can now move onto the ‘Volume’ tab in which we will be specifying the directory where we saved our n-grams data from earlier.

Click on ‘Add Folder’ then navigate to the ‘languagetool’ folder we created and click on ‘Select’

In the ‘Mount path’ section enter /ngrams

Network

We are not going to be specifying a specific port for this container so we will allow it to use the host network. So tick the ‘Use the same network as Docker Host’ option.

Links / Port Settings

You do not need to setup anything on these tabs.

Environment Variables

We need to set a few environment variables, these tell the container to configure itself is a specific way based on this additional options.

Click on the add button and enter the following details as per the table, it is important these are added exactly as shown.

variableValue
langtool_languageModel/ngrams
Java_Xms512m
Java_Xmx1g

Almost Done

You have now completed the setup of the container.

Click on Apply to move back to the initial settings screen and then click next, you will be shown an overall summary of the settings we have specified, this is a good time to double-check everything is correct. Finally, click on Done and the container should start to boot.

Configuring the Extensions

With the container running we can now configure the specific extensions LanguageTool offers to point its queries to our local version of the tool. I am using the Chrome plugin as an example, but the premise is the same for each one.

Once the extension has been installed head into its settings (where these are located will depend on your browser)

First up I have Picky mode and synonyms enabled

Then you will see a section called ‘Experimental settings (only for advanced users)

In this section we are going to select the ‘Other server’ option and then enter ‘http://YOURNASIP:8010/v2’ ensuring you have entered your own IP.

Let’s test to see if everything is working correctly.

Open up pastebin.com and copy the text below into the ‘New Paste’ section.

Dear Jane,

I was delighted to read you're letter last week. Its always a pleasure to recieve the latest news and to here that you and your family had a great summer.

We spent last week at the beach and had so much fun on the sand and in the water exploring the coast we weren't prepared for the rains that came at the end of the vacation. The best parts of the trip was the opportunities to sightsee and relax.

My kids are back in school to. I find their are less things to worry about now that the kids are at school all day. There is plenty of fun things to do in the summer, but by August, I've running out of ideas. I've excepted the fact that we'll have to think up brand-new activities next summer; hoping to round up some creative ideas soon.

Thanks again for your letter!

Sincerely,
Karen

You will see an animation in the bottom right, this means the tool is checking the sentences, after a few seconds you will see the results of the analysis with the suggested changes highlighted.

Docker Compose

You can use the below code saved as languagetool.yml to do the entire process above in one quick command via SSH.

version: "3.2"
services:
  languagetool:
    image: erikvl87/languagetool
    container_name: languagetool
    network_mode: host
    environment:
        - langtool_languageModel=/ngrams
        - Java_Xms=512m
        - Java_Xmx=1g
    volumes:
        - /volume1/docker/languagetool:/ngrams
sudo docker-compose -f /volume1/docker/languagetool/
languagetool.yml up -d

Throw me some bits or buy me a coffee?

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running the site, you can even buy me a coffee 🙂

Buy Me A Coffee
  • Bitcoin
  • Ethereum
  • Tether
  • Cardano
  • Polkadot
  • Binance coin
  • Litecoin
  • Bitcoin cash
  • Dogecoin
  • Monero
  • Omisego
Scan to Donate Bitcoin to bc1qfq8ccs2yar7aa60fye8wdpanwtvpqzvrys4h6u

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Tag/Note:- Donations
Scan to Donate Ethereum to 0x7C5A441a6Dd520a796442DC6DeFeFE88d79D95f3

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Tether to 0x7C5A441a6Dd520a796442DC6DeFeFE88d79D95f3

Donate Tether to this address

Scan the QR code or copy the address below into your wallet to send some Tether

Scan to Donate Cardano to addr1qysaldwdyqu9u8y9a0l5d35sqv202xr4768se8wevlexatepm76u6gpctcwgt6llgmrfqqc575v8ta50pjwajeljd6hsa6ggvv

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Polkadot to 14R7Xr3587UKYsnnLhvBd7YfVgXkW9i3FU4kHP8DocsdLSha

Donate Polkadot to this address

Scan the QR code or copy the address below into your wallet to send some Polkadot

Scan to Donate Binance coin to bnb14ye5rju74u5ythneaum2rjvp8eqep6wq8flghx

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Litecoin to LfNfer3aSqLx4p8KfbbkT96ArXLXLDPxoD

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Bitcoin cash to qqz9pgaxdz4mtdxqxnlk7apqmsn6qzw9j5pn5jpvrc

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Dogecoin to DCwbNzfYHx22MDSyEVLWgfjxziYHtcgwAM

Donate Dogecoin to this address

Scan the QR code or copy the address below into your wallet to send some Dogecoin

Scan to Donate Monero to 45qwFr42XiA8egC5z2HdSQ2FzzP9VR1MvD5Sicg4EhGvdvTutx9GsF6DeU8DHAsTZy2ShBERjCB5rdy8iQ9CFnFu9Z6Adgw

Donate Monero to this address

Scan the QR code or copy the address below into your wallet to send some Monero

Scan to Donate Omisego to 0x162fc7781D3C6c6f27197A3A92567b5DAF258f19

Donate Omisego to this address

Scan the QR code or copy the address below into your wallet to send some Omisego

Published inDockerSynology

4 Comments

  1. Junior Junior

    Awesome! Thanks

  2. tempata tempata

    Thank you. It’s very interesting. I’m just not sure about one thing. I’ve downloaded just EN ngrams files, but if I set in the preferred language settings another language (that is not downloaded to my FileStation) it will check it and correct spelling right.

    This is strange, so it connects to their servers to check that other language?

    Thank you for your answer.

    • Dr_Frankenstein Dr_Frankenstein

      Hey, it will check spellings with its built in basic data, the engrams provide it with additional abilities such as offering alternatives etc. So it’s still all local even the other languages are baked in to the base image.

      • tempata tempata

        Oh, wow. That’s nice. Thank you for prompt answer.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.