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
- Install from PyPI:
pipx install gramcheck. - Point it at your server:
gramcheck --set-server-url http://127.0.0.1:8080(writes_GC_SERVER_URLto.envin the project directory).
Usage
- Check a file:
gramcheck example.txt. - Check a single text:
gramcheck -t 'Your text here'. - Check the Nth line in a file:
gramcheck example.txt -n 0(0-based, so-n 0is the first line). - Check a file as a whole:
gramcheck example.txt -a. - 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
- Install the
uvproject manager. - Clone the repository:
git clone https://github.com/degD/gramcheckand runuv sync. - Point it at your server:
gramcheck --set-server-url http://127.0.0.1:8080(or edit.envdirectly). - Run locally with
python gramcheck.py(or./gramcheckon 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)
| File | Size | Uploaded | |
|---|---|---|---|
| gramcheck-0.2.0.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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}
|