|New guide released||12/12/2021|
|Added note relating to the Desktop App||14/02/2022|
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.
In this guide I will take you through the steps of getting it setup in Docker on your Synology NAS.
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.
Open up Filestation and create a folder within the docker share called ‘languagetool’
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 site below and download the data for your language, you can save the zip file to your computer, the English zip is around 8Gb.
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.
You can see the progress in the top right side 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.
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 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
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.
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.
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.
Follow the guide above until you reach the ‘Downloading the LanguageTool Image’ section. You can then use the code below saved as languagetool.yml in the ‘/docker/languagetool’ share this will do the rest of the process above in one quick command via SSH.
version: "3.8" 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 🙂