Skip to content

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

Last updated on 16 November 2023

Please note if you are using DSM7.2 or higher you should use the Container Manager version of this guide from the menu.
This guide has reached the end of its updates as most people are now on the latest DSM update - This guide is correct as of 08/12/2023 however no further updates will be added.
UpdateDate
Amended the path to save the compose file – this is for security, so the container has no access to the file contents.14/04/2023
Note and amendment made for NAS models with older Celeron CPUs09/11/2023
Historic updates now at the end of the guide.


What is LanguageTool?

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.

Please note that the self-hosted server using Docker can only be used with the Browser and Office add-ons – unfortunately the desktop app does not support self-hosting.

Let’s Begin

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

Please note as of the November 2023 in order to use the built-in fasttext functionality you will need a Synology model using a CPU newer than the Intel Celeron J3 series. What kind of CPU does my Synology NAS have? However, you can use the other functionality if you continue.

First up you need to follow these two guides in order to follow the rest of the guide successfully

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 either having an SSD read cache or if you have upgraded your systems’ memory this will speed up things considerably.

Folder Structure

Open up Filestation and create a folder within the docker share called ‘languagetool’ then within this folder create two separate subfolders called ‘ngrams’ and ‘fasttext’

Downloading the LanguageTool Image

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 Meyay.

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 be greeted with the Network screen, we will be using the ‘synobridge’ network we created earlier select it from the list and click Next.

General Settings

Next you will be greeted with the General Settings screen, this is where you can start specifying some of your preferences.

You can change the name of the container to anything you like, and you may want to enable Auto Restart as this will ensure LanguageTool starts automatically if you reboot your NAS.

Now click on the Advanced Settings button.

Environment

We need to set a few environment variables, these tell the container to configure itself based on these 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.

VariableValueComments
download_ngrams_for_langsenOptions available
en=english
de=german
es=spanish
fr=french
nl=dutch
langtool_languageModel/ngrams
langtool_fasttextModel/fasttext/lid.176.binRemove this if you have an older model NAS as noted at the start of the guide.
MAP_UIDYOURUIDfor your dockerlimited user
MAP_GIDYOURGIDfor your dockerlimited user

You do not need to set up anything on these tabs.

Press ‘Save’ to go back to the initial setup screen, then press ‘Next’

Port Settings

We won’t be changing any of the ports the container uses. You can repeat the ones shown on the right side of the settings page ‘Container Port’ onto the left side ‘Local Port’ once you have done this press ‘Next’.

Volume Settings

We will now be specifying the directories where the ngrams and fasttext files will be stored.

Click on ‘Add Folder’ then navigate to the ‘languagetool’ folder we created earlier, you then select the fasttext folder and then do the same again selecting the ngrams folder.

In the ‘Mount path’ section enter /ngrams and /fasttext as shown below.

Summary

You have now completed the setup of the container.

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.

You need to be patient as the first start-up will take some time to download the ngrams and fastText files (14.5Gb) this will depend on the speed of your connection.


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 installed head into its settings (where these are located will depend on your browser)

First up I have Picky mode enabled ignore the login prompt.

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 https://paste.drfrankenstein.co.uk/ and copy the text below into the ‘Editor’ section.

Plaintext
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.

You are now all set up.


Historic UpdatesDate
New guide released12/12/2021
Added note relating to the Desktop App14/02/2022
Updated screenshots and steps for DSM7.116/06/2022
Added new port settings and Docker Bridge Network23/07/2022
Moved to a new container image that includes fastText and simplifies the setup! Thanks to one-eyed-king on SynoForum23/09/2022
Compose version number removed and small wording amendments09/04/2023
Historic Updates

Buy Me a Coffee or a Beer

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me get the odd beverage. Plus 10% goes to the devs of the apps I do guides for every year.

Published inDockerOther Tools 7.1Synology

13 Comments

  1. RockmanRock RockmanRock

    Good guide and has been working great for a few months. Doing the upgrade to the new docker image source, and noticed that in the screenshots above you have the ngrams and fasttools folder links backwards – each points to the other one. The docker compose text has them the correct way round.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!