Server implementation of the LanguageTool API for offline grammar and spell checking, based on:
- https://github.com/bminixhofer/nlprule for grammar and style checking, using the LanguageTool rules.
- https://github.com/reneklacan/symspell for spell-checking
This also contains a simple command-line client, displaying results graphically with ariadne.
See https://c.pgdm.ch/eps-projects/ltapiserv-rs
The recommended method is to get a binary from the releases page and install it as a systemd service:
$ sudo cp ltapiserv-rs /usr/local/bin
$ sudo chmod +x /usr/local/bin/ltapiserv-rs
$ ln -s $(pwd)/ltapiserv-rs.service ~/.config/systemd/user/ltapiserv-rs.service
$ systemctl --user daemon-reload && systemctl --user enable --now ltapiserv-rs
$ systemctl --user status ltapiserv-rs
A path to a custom dictionary can be passed to the server via the --dictionary
option. The default systemd
configuration places it in ~/dictionary.txt
.
Alternatively, binaries can be built from source as follows:
$ # Create en_US.tar.gz data archive (will be embedded in the binary).
$ bash create_archive.sh
$ cargo build --release
Install the official LanguageTool browser extension (e.g. for Chrome or Firefox) and configure it to use your local server:
A command line client, ltapi-client
, is also included in this codebase.
$ cat text.txt | ltapi-client --server http://localhost:8875
$ ltapi-client --server http://localhost:8875 test.txt
The return code will be 1
if any error is detected.
The server address can be configured through the LTAPI_SERVER
environment variable.
Formats like Markdown, HTML, LaTeX etc. can be processed through pandoc
:
$ pandoc README.md -t plain | ltapi-client
(use-package flycheck-languagetool
:ensure t
:hook (text-mode . flycheck-languagetool-setup)
:init
(setq flycheck-languagetool-url "http://127.0.0.1:8875")
)