Privacy-first, GPU-accelerated text correction pipeline for preprocessing long-form documents before TTS playback.
π 3.6x faster with GPU acceleration β’ π― 100% test accuracy β’ π Completely offline β’ π¨ Modern GUI
SATCN Pipeline GUI - Configure filters, view real-time logs, process documents
SATCN LLM GUI - Model management, HuggingFace downloader, GPU-accelerated correction
SATCN is a privacy-first document correction tool that runs entirely on your machine:
| Feature | Description |
|---|---|
| π€ AI-Powered Corrections | State-of-the-art ML models (GRMR-V3, T5, LanguageTool) |
| π Format Preservation | Maintains Markdown and EPUB structure + author voice |
| π 100% Offline | No cloud APIs, no telemetry, complete privacy |
| β‘ GPU Accelerated | 3.6x faster with NVIDIA CUDA (1,587 words/min) |
| ποΈ TTS Optimized | Expands numbers, dates, currency for natural speech |
| π― Production Ready | 100% test accuracy, A-grade quality (95/100) |
graph LR
A[π Input Document] --> B[π Parse]
B --> C[β
Grammar Check]
C --> D[π Spell Check]
D --> E[ποΈ TTS Normalize]
E --> F[β¨ Clean Output]
Input β Parse β Grammar β Spelling β TTS Normalization β Output
Choose the engine that fits your needs:
| Engine | Speed | Quality | Memory | GPU Support | Status |
|---|---|---|---|---|---|
| GRMR-V3 GGUF β | 1,587 wpm | A (95/100) | 4GB RAM | β Yes | Recommended |
| T5 Transformer | Moderate | High | 8GB+ RAM | β Yes | Experimental |
| LanguageTool | Slower | Good | Low | β No | Fallback |
π Detailed Comparison
- β 100% test accuracy (51/51 tests passing)
- β GPU-accelerated (3.6x speedup)
- β 4096 token context window
- β Character name preservation (99%+)
- β Deterministic output (temperature 0.1)
- π¦ Model size: ~2.5GB (Q4 quantization)
β οΈ Context-aware correctionsβ οΈ Memory-intensive (8GB+ RAM)β οΈ 512 token context window- π¬ Experimental status
- β Rule-based, conservative
- β Low memory footprint
- β No GPU acceleration
- β Slower processing
Supported Formats: Markdown (.md), EPUB (.epub), Plain Text (.txt)
# 1οΈβ£ Clone the repository
git clone https://github.com/hebbihebb/SATCN.git
cd SATCN
# 2οΈβ£ Install base package
pip install -e .
# 3οΈβ£ Choose your installation extras:Installation Options:
# β Recommended: GRMR-V3 (best quality + GPU support)
pip install -e ".[grmr]"
# π¬ Experimental: T5 transformer support
pip install -e ".[t5]"
# π¨ GUI interface (CustomTkinter)
pip install -e ".[gui]"
# π οΈ Development tools (pytest, ruff, black)
pip install -e ".[dev]"
# π Everything at once
pip install -e ".[all]"π What gets installed?
| Extra | Packages Installed |
|---|---|
grmr |
llama-cpp-python, numpy, diskcache |
t5 |
transformers, torch, accelerate, sentencepiece |
gui |
customtkinter (β₯5.2.0) |
dev |
pytest, pytest-cov, ruff, black, isort, pre-commit |
all |
Everything above |
# π Process a document (default: rule-based correction)
satcn input.md
# β Use GRMR-V3 AI model (recommended)
satcn --use-grmr input.md
# π Hybrid mode (AI + spell-check + rules)
satcn --use-grmr --grmr-mode hybrid input.epub
# π¬ Use T5 transformer model
satcn --use-t5 --grmr-mode replace input.md
# π― Fail-fast mode (stop on first error)
satcn --use-grmr --fail-fast input.mdOutput: Creates {input_name}_corrected.{ext} in the same directory
# π¨ Launch main Pipeline GUI
satcn-gui
# Alternative: python -m satcn.gui.satcn_gui
# π€ Launch LLM Model GUI (for model management)
python launchers/launch_llm_gui.py
# πͺ Windows users: Double-click launcher files
# - launchers/launch_satcn_gui.bat
# - launchers/launch_llm_gui.batSATCN provides two powerful GUI applications for different workflows:
The main GUI for document processing with full pipeline control.
|
π― Key Features
|
β¨οΈ Keyboard Shortcuts
π¦ Launch Commands satcn-gui
# or
python -m satcn.gui.satcn_gui |
πΎ Configuration: Auto-saved to ~/.config/satcn/gui_config.json
New addition focusing on LLM model management and HuggingFace integration.
|
π€ Key Features
|
π Perfect For
π¦ Launch Commands python launchers/launch_llm_gui.py
# Windows: launchers/launch_llm_gui.bat |
πΎ Configuration: Auto-saved to ~/.config/satcn/llm_gui_config.json
π Documentation: See docs/LLM_GUI_README.md for detailed guide
| Feature | Pipeline GUI | LLM GUI |
|---|---|---|
| Use Case | Production document processing | Model testing & downloads |
| Grammar Engines | All (GRMR, T5, LanguageTool, None) | GRMR-V3 only |
| HuggingFace Integration | β | β Yes |
| Diff Viewer | β | β Yes |
| Batch Processing | β Yes | β No |
| Keyboard Shortcuts | β Yes | Limited |
| Best For | Daily use, production | Model management |
Unlock 3.6x faster processing with NVIDIA CUDA support!
| Mode | Speed | Processing Time (15K words) |
|---|---|---|
| π₯οΈ CPU | 438 words/min | ~34 minutes |
| π GPU (CUDA) | 1,587 words/min | ~10 minutes |
| Speedup | 3.6x faster | 70% time saved |
Click to expand GPU setup instructions
Prerequisites:
- β NVIDIA GPU with CUDA support
- β CUDA Toolkit 13.0
- β Visual Studio 2022 (Build Tools)
- β Python 3.11+
Installation Steps:
# 1οΈβ£ Run automated CUDA build (~38 minutes)
.\install_llama_cpp_cuda.ps1
# 2οΈβ£ Add CUDA to PATH
$env:PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\x64;$env:PATH"
# 3οΈβ£ Verify GPU detection
python scripts/check_cuda.py
# 4οΈβ£ Run with GPU acceleration
satcn --use-grmr input.mdβ Verification:
- Look for
"Using GPU: True"in console output - Check for
n_gpu_layers: -1in logs (all layers offloaded)
π Detailed Guide: docs/GPU_SETUP_GUIDE.md
π Troubleshooting: docs/GPU_ACCELERATION_STATUS.md
SATCN uses a modular pipeline architecture where each filter transforms a shared data structure:
# π§ Filter Protocol
class Filter:
def process(self, data: dict) -> dict:
"""
Transform text blocks while preserving metadata
data = {
'text_blocks': [
{'content': str, 'metadata': dict},
...
],
'tree': parsed_document_tree,
'format': 'markdown' | 'epub',
'filepath': str
}
"""
# Transform text_blocks, preserve metadata
return modified_dataπ― Design Principles:
- β Metadata preservation - Round-trip document reconstruction
- β Filter composability - Mix and match correction engines
- β Error isolation - Fail-fast or continue-on-error modes
- β Stateless processing - Each filter is independent
π Available Filters
| Filter | Purpose | Input | Output |
|---|---|---|---|
markdown_parser.py |
Parse Markdown files | .md file |
Text blocks + metadata |
epub_parser.py |
Parse EPUB files | .epub file |
Text blocks + metadata |
grammar_filter.py |
Rule-based grammar | Text blocks | Corrected text |
grmr_v3_filter.py |
AI grammar (GGUF) | Text blocks | Corrected text |
t5_grammar_filter.py |
T5 transformer | Text blocks | Corrected text |
spelling_filter.py |
Spell checking | Text blocks | Corrected text |
tts_normalizer.py |
TTS optimization | Text blocks | Normalized text |
|
π― Quality Metrics
|
β‘ Performance Metrics
|
π Real-World Testing:
- β Tested on 15,000+ word documents
- β Maintains formatting and structure
- β Preserves author voice and style
- β Handles technical vocabulary correctly
1οΈβ£ Launch 2οΈβ£ Select File 3οΈβ£ Choose Engine 4οΈβ£ Run 5οΈβ£ Review
GUI β Browse... β GRMR-V3 β Process β Output
π Detailed Step-by-Step Guide
1. Launch the GUI
satcn-gui
# or double-click: launchers/launch_satcn_gui.bat (Windows)2. Select Your Document
- Click "Browse..." button
- Choose
.md,.txt, or.epubfile - File statistics will appear (word count, estimated time)
3. Choose Grammar Engine
| Engine | When to Use |
|---|---|
| GRMR-V3 GGUF β | Best quality, GPU support, recommended |
| LanguageTool | No dependencies, conservative |
| T5 Transformer | Experimental, requires T5 extras |
| None | Skip grammar (use only TTS normalization) |
4. Select Correction Mode (for GRMR-V3/T5)
| Mode | Description |
|---|---|
| Replace | Use only AI model corrections |
| Hybrid | AI + spell-check + rule-based (most thorough) |
| Supplement | Rule-based first, then AI for remaining issues |
5. Run Pipeline
- Click "Run Pipeline" (or
Ctrl+R) - Watch real-time progress bar
- Monitor live log output
6. Find Your Corrected Document
- Output location:
{input_name}_corrected.{ext} - Saved in same directory as input file
Your preferences are automatically saved and restored:
| OS | Configuration Path |
|---|---|
| π§ Linux | ~/.config/satcn/gui_config.json |
| π macOS | ~/.config/satcn/gui_config.json |
| πͺ Windows | C:\Users\<username>\.config\satcn\gui_config.json |
Comprehensive guides for setup, usage, and development:
| Guide | Description |
|---|---|
| π GPU Setup Guide | CUDA installation, troubleshooting, performance optimization |
| π€ LLM GUI Guide | Model management, HuggingFace integration, diff viewer |
| π GRMR-V3 Quality Report | Real-world 15K-word analysis and benchmarks |
| π¬ T5 Integration Guide | Transformer model setup and usage |
| π οΈ Contributing Guidelines | Development setup, code style, PR process |
| π Legacy Migration | Old β new project structure |
SATCN has a comprehensive test suite with 100% pass rate:
# π§ͺ Run all tests (unit + integration)
pytest
# π¦ Unit tests only
pytest tests/unit/
# π Integration tests
pytest tests/integration/
# π Test coverage report
pytest --cov=src/satcn --cov-report=html# β GRMR-V3 quality benchmark (51 tests, 100% expected)
python scripts/benchmark_grmr_quality.py
# π GRMR-V3 vs T5 comparison
python scripts/benchmark_grmr_vs_t5.py
# π Long document test (15K+ words, GPU recommended)
python scripts/test_long_document_gpu.py
# π¬ Quantization comparison (Q4 vs Q8)
python scripts/compare_q4_vs_q8.py# π₯οΈ Check CUDA availability
python scripts/check_cuda.py
# β‘ Quick GPU performance test
python scripts/quick_gpu_test.py
# π Detailed GPU diagnostics
python scripts/diagnose_gpu_performance.py
# β
Verify GPU acceleration
python scripts/verify_gpu_acceleration.pytests/
βββ unit/ # Component-level tests
β βββ test_markdown_parser.py
β βββ test_grmr_v3_filter.py
β βββ test_t5_corrector.py
β βββ ...
βββ integration/ # End-to-end pipeline tests
β βββ test_pipeline.py
βββ regression_corpus/ # Regression test data
β βββ input*.md
β βββ golden*.md
βββ samples/ # Sample documents
Our core principles guide every decision:
| Principle | Description |
|---|---|
| π Privacy-First | No cloud APIs, no telemetry, 100% local processing |
| π― Quality Over Speed | GPU acceleration makes it fast; accuracy is paramount |
| π§ͺ Test-Driven | All changes must pass 100% quality benchmark (51/51 tests) |
| ποΈ TTS-Optimized | Purpose-built for text-to-speech preprocessing |
| π» Local-Only | Your documents never leave your machine |
| π§© Modular Design | Composable filters, extensible architecture |
We intentionally do not support:
- β Real-time collaborative editing
- β Cloud SaaS deployment
- β Mobile apps
- β Multi-user systems
- β Online telemetry
Focus: Single-user, offline, batch document processing for TTS preparation.
We welcome contributions! Here's how to get involved:
# 1οΈβ£ Fork and clone
git clone https://github.com/YOUR_USERNAME/SATCN.git
cd SATCN
# 2οΈβ£ Install with dev dependencies
pip install -e ".[dev]"
# 3οΈβ£ Install pre-commit hooks
pre-commit install
# 4οΈβ£ Run tests
pytest
# 5οΈβ£ Make changes and test
# ... edit code ...
pytest
ruff check .
black --check .- β Code follows Black formatting
- β Passes Ruff linting
- β
All tests pass (
pytest) - β
Quality benchmark still 100% (
python scripts/benchmark_grmr_quality.py) - β Type hints where appropriate
- β Docstrings for new functions
- β Pre-commit hooks pass
| Resource | Link |
|---|---|
| π οΈ Contributing Guide | docs/CONTRIBUTING.md |
| ποΈ Architecture Docs | See "Architecture" section above |
| π§ͺ Testing Guide | See "Testing" section above |
| π Code Style | Black + Ruff + isort |
MIT License - Free to use, modify, and distribute. See repository for full license details.
SATCN builds on excellent open-source projects and models:
| Project | Author | Purpose |
|---|---|---|
| GRMR-V3-Q4B | qingy2024 (HuggingFace) | Grammar correction GGUF model |
| llama-cpp-python | abetlen | GGUF model inference with GPU support |
| LanguageTool | LanguageTool.org | Rule-based grammar checking |
| FLAN-T5 | Google Research | Experimental T5 transformer support |
| CustomTkinter | TomSchimansky | Modern GUI framework |
Special thanks to the open-source community for making privacy-preserving AI accessible! π
| Resource | URL |
|---|---|
| π¦ Repository | https://github.com/hebbihebb/SATCN |
| π Issue Tracker | https://github.com/hebbihebb/SATCN/issues |
| π Documentation | See docs/ directory |
| π¬ Discussions | GitHub Issues |
Made with β€οΈ for privacy-conscious writers and TTS enthusiasts
β Star this repo if you find it useful!