Skip to content

Instantly share code, notes, and snippets.

@quentinms
Created April 11, 2022 14:31
Show Gist options
  • Save quentinms/def181b3e9aaa306f22ca9140529ca3e to your computer and use it in GitHub Desktop.
Save quentinms/def181b3e9aaa306f22ca9140529ca3e to your computer and use it in GitHub Desktop.
Running LanguageTool locally

Running LanguageTool locally

Running the server

  1. Install LanguageTool
brew install languagetool
  1. Download the n-gram model for English (it’s 8 GB!) https://dev.languagetool.org/finding-errors-using-n-gram-data
  2. Create a config file that will tell it to use the n-gram model
languageModel=/path/to/directory/languagetools-ngrams
  1. Start the server
languagetool-server --allow-origin "*" --config ~/path/to/languagetool-config/config

HTTPS proxy

Set up HTTPS (otherwise some browser extensions might not work).

  1. Install caddy
brew install caddy
  1. Start caddy
caddy run --config ~/path/to/caddy/config.json

(See snippet for the caddy config, feel free to change the ports accordingly)

Set up the browser extensions

  1. Install the extension for your browser (Firefox, Safari, Chrome)
  2. Go to "Advanced Settings" and choose "Local server (localhost)" as the "LanguageTool API server URL"
{
"apps": {
"http": {
"servers": {
"localhost": {
"listen": [
":9081"
],
"automatic_https": {
"disable_redirects": true
},
"routes": [
{
"match": [{
"host": [
"localhost"
]
}],
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "127.0.0.1:8081"
}
]
}
]
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment