Skip to content

v0.4.0 — LanguageTool contract, style tier, make install

Choose a tag to compare

@chethan62 chethan62 released this 28 Sep 19:23
· 54 commits to main since this release

Offline grammar, style and delivery checking behind the LanguageTool /v2/check API — no Java, no cloud, no account. harper-ls is the engine.

Request contract — everything LanguageTool clients send: enabledRules/disabledRules (LanguageTool rule ids or harper's own names), enabledCategories/disabledCategories, enabledOnly, level, preferredVariants, motherTongue, data=/text, warnings.incompleteResults. Rule toggles reach the engine, so rules harper ships off can be switched on.

Style tier (opt-in via level: "picky" or enabledCategories: ["STYLE"]) — three deterministic passes, no model involved: WORDINESS (33 wordy phrases → the concise form), PREFERRED_TERM (10 non-preferred forms → the house-style one: e-mail → email, whilst → while), PASSIVE_VOICE_SIMPLE (LanguageTool's own id).

Engine — harper 2.11.0, 892 rules, 12 off by default. One persistent harper-ls, documents closed after each check, a quiet engine reconnects and retries once, and long documents are chunked (~12 KB, sentence-aligned) so offsets stay correct into the hundreds of kilobytes.

Also — GET /v2/stats (words, sentences, grade level, reading time), POST /v2/rewrite (optional, needs a local Ollama), GET /v2/languages, GET /status (reports the dialect the engine is on). Loopback by default; 200,000-character cap with LanguageTool's own 413 shape.

Install

make install                      # binary → ~/.local/bin, user unit installed
systemctl --user enable --now grammar-server

or make bundle-local for a portable directory to copy anywhere. Needs harper-ls on PATH (sudo pacman -S harper, brew install harper, or point --harper at it).

Measured on this machine — 65-word documents at level=picky: p50 62 ms / p95 102 ms with one request in flight (~20 ms of linter plus ~5 ms per match fetching suggestions), ~20 checks/s aggregate, zero failures or timeouts in a 183-request concurrent load test.

Verified — go test ./... green; CI runs gofmt, go vet and the full suite against harper 2.11.0.