What's New
Kirchenbauer Watermark Detector
Green-list z-test based on Kirchenbauer et al. 2023. Uses SHA-256 hash of previous token to partition vocabulary into green/red lists (γ=0.25), computes z-score and p-value. Flags AI watermark at z ≥ 4.0.
from texthumanize import detect_watermarks
report = detect_watermarks(text)
print(report.kirchenbauer_score, report.kirchenbauer_p_value)HTML Diff Report
explain() now supports multiple output formats:
html = explain(result, fmt='html') # self-contained HTML page
json_str = explain(result, fmt='json') # RFC 6902 JSON Patch
diff = explain(result, fmt='diff') # unified diffQuality Gate
CLI + GitHub Action + pre-commit hook to check text for AI artifacts:
python -m texthumanize.quality_gate README.md docs/ --ai-threshold 25Selective Humanization
Process only AI-flagged sentences, leaving human text untouched:
result = humanize(text, only_flagged=True)Stylometric Anonymizer
Disguise authorship by transforming text toward a target style:
from texthumanize import anonymize_style
result = anonymize_style(text, target='blogger')Stats
- 1,373 Python tests passing
- 40 new tests for v0.9.0 features
- Ruff lint clean
- 22 files changed, 1,637 additions