Skip to main content

GRAMCHECK

A Python tool to check text for grammar mistakes using local LLMs. It connects to any OpenAI-compatible server (e.g. llama-server) and streams corrections back as they are generated.

Because of the probabilistic nature of LLMs, results may or may not be correct. Take them with a grain of salt. Results are generated using a predefined seed to keep them consistent.

Currently does not support API keys. Future versions will plan API keys to enable support for online providers. Example tests are also planned for future versions.

Requirements

  • Python 3.8+
  • A running llama-server (or any OpenAI-compatible endpoint)
  • A capable instruction-tuned model. Recommended: Q4 or higher quantization. Q2 quants and sub-4B models often fail to follow the output format.

Install

  1. Install from PyPI: pipx install gramcheck.
  2. Point it at your server: gramcheck --set-server-url http://127.0.0.1:8080 (writes _GC_SERVER_URL to .env in the project directory).

Usage

  1. Check a file: gramcheck example.txt.
  2. Check a single text: gramcheck -t 'Your text here'.
  3. Check the Nth line in a file: gramcheck example.txt -n 0 (0-based, so -n 0 is the first line).
  4. Check a file as a whole: gramcheck example.txt -a.
  5. Show help: gramcheck --help.

Output

Each text is printed in red, followed by the model's corrections in green. Corrections are one line per error in the form original -> corrected. If a text has no errors, the model outputs OK.

Development

  1. Install the uv project manager.
  2. Clone the repository: git clone https://github.com/degD/gramcheck and run uv sync.
  3. Point it at your server: gramcheck --set-server-url http://127.0.0.1:8080 (or edit .env directly).
  4. Run locally with python gramcheck.py (or ./gramcheck on Unix-like systems).

Supported servers

Any endpoint that implements the OpenAI Chat Completions API (/v1/chat/completions) with streaming SSE. Tested with llama-server from llama.cpp.

See the documentation for llama-server-specific configuration.

License

MIT

Metadata

Release files for gramcheck 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gramcheck 0.2.0
File Size Uploaded
gramcheck-0.2.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gramcheck 0.2.0
File Interpreter ABI Platform
gramcheck-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / gramcheck-0.2.0.tar.gz

Download URL gramcheck-0.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bda973da2ad01d086e02dca3c16a4c405de693b53151727e7b8626d474ca7def
BLAKE2b-256 checksum
How to use checksums
292bc8720bf87223a302f8c2d9eed24997e34d4494a97233cb13f7ada64dedfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gramcheck-0.2.0-py3-none-any.whl

Download URL gramcheck-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
892f19de5f1bd0fdd4b31953b076482652a3ebdcc0f415c8881e216b7f042584
BLAKE2b-256 checksum
How to use checksums
b20b111faa5e3b19a773d5b09c2d23e57e568228dc862505f1708d082081737a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page