Metadata-Version: 2.4
Name: pygrammar-fix
Version: 0.1.0
Summary: Fast, offline long-paragraph grammar correction that orchestrates harper-py and nlprule.
Author-email: Ankit Arora <you@example.com>
License: MIT
Project-URL: Homepage, https://github.com/ankitarora05/pygrammar-fix
Project-URL: Repository, https://github.com/ankitarora05/pygrammar-fix
Project-URL: Issues, https://github.com/ankitarora05/pygrammar-fix/issues
Keywords: grammar,spelling,nlp,harper,nlprule,correction
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: harper-py>=0.1.1
Requires-Dist: pyspellchecker>=0.8
Provides-Extra: nlprule
Requires-Dist: nlprule>=0.6.3; (sys_platform != "darwin" or platform_machine != "arm64") and extra == "nlprule"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Requires-Dist: nlprule>=0.6.3; (sys_platform != "darwin" or platform_machine != "arm64") and extra == "dev"
Dynamic: license-file

# Grammar Orchestrator

Fast, offline long-paragraph grammar correction that combines the strengths of
[`harper-py`](https://pypi.org/project/harper-py/) and
[`nlprule`](https://pypi.org/project/nlprule/).

- **Fast and offline** – both engines ship as self-contained Rust wheels; no Java, no server.
- **Returns fixed text** – `fix()` gives you the corrected string directly.
- **Handles long paragraphs** – sentence-aware chunking keeps each engine call reliable.
- **Best of both** – default to `nlprule` for `correct()` convenience and multilingual support, or opt into `harper` for maximum English speed.
- **Pure-Python meta-package** – depends on the two pre-built engines; you never compile Rust.

## Install

```bash
pip install pygrammar-fix
```

## Quick start

```python
from pygrammar_fix import GrammarFixer

fixer = GrammarFixer()                 # defaults: lang="en", prefer="nlprule"
fixed = fixer.fix("This is an test of the the linter.")
print(fixed)

# Structured suggestions without applying them:
for suggestion in fixer.suggest("She was not been here since Monday."):
    print(suggestion["start"], suggestion["end"], suggestion["message"], suggestion["replacements"])

```

## Engine selection

``` python
# Maximum speed on English (harper-py):
fixer = GrammarFixer(prefer="harper")

# German or Spanish (nlprule only):
fixer = GrammarFixer(lang="de")
```

## Architecture

The package is a thin orchestrator, not a merged binding:

Adapters (_adapters.py) wrap harper-py and nlprule behind a common
suggest/correct interface.

Chunker (_chunker.py) performs sentence-aware splitting so long
paragraphs never go to an engine in one piece.

Orchestrator (GrammarFixer) handles engine selection, lazy loading, and
the public fix() / suggest() API.
