pygarble: English gibberish detection

Deterministic, lightweight gibberish detection for English text.

pygarble combines fixed character models, English word patterns, keyboard paths, and encoding checks. It has no runtime dependencies, training, or downloads. Meaningful Hindi and other non-English text may be flagged; this is expected for English-specific scoring. It is not a language identifier or a semantic nonsense detector. Scores are heuristics, not calibrated probabilities.

These docs cover the upcoming 0.9.0 API, not yet published to PyPI. See Installation for published-package and source installation options.

Quick Start

from pygarble import EnsembleDetector

detector = EnsembleDetector()
detector.predict("Hello world")     # False
detector.predict("asdfghjkl")       # True
detector.predict("नमस्ते दुनिया")    # True: English-specific checks
detector.predict("hello\x00world")  # True: control artifact

Use profile="corruption" to check encoding/control artifacts independently of English plausibility, or profile="english_extended" for more aggressive localized and repetition detection. See API Reference for explanations, batching, per-strategy configuration, and abstention behavior.

Evaluation

The repository preserves its legacy benchmark separately from reviewed English labels and a small authored challenge set. Reported engineering results are not production precision estimates. Run python regression/evaluate.py --split all to reproduce metrics, or add --details for per-category errors.