Detect AI writing patterns. Make text human again.
Project description
ai-text-audit ๐ฆ
Detect AI writing patterns. Make text human again.
A fast, offline CLI tool and Python library that detects AI-generated text patterns based on linguistic analysis โ no API keys, no cloud, no privacy concerns.
Built from analysis of 10,000+ AI-generated texts, based on Wikipedia's comprehensive guide to AI writing patterns.
โจ Features
- ๐ 22+ AI pattern detectors โ em-dashes, rule of three, AI vocabulary, promotional language, vague attribution, and more
- ๐ Weighted scoring โ patterns ranked by severity, not just frequency
- ๐ฏ Smart suggestions โ actionable rewrite tips for each detected pattern
- ๐ Pipeline mode โ
--jsonoutput for CI/CD integration - โก Fast โ analyzes 1000 words in <50ms, no network calls
- ๐ Offline โ zero external dependencies for core detection
- ๐ ๏ธ Extensible โ add your own patterns with simple YAML config
- ๐ Batch mode โ process entire directories or stdin
๐ Quick Start
pip install ai-text-audit
# Analyze a file
ai-audit README.md
# Analyze from stdin
echo "This groundbreaking tool represents a pivotal advancement..." | ai-audit -
# JSON output for pipelines
ai-audit --json document.md
๐ Usage
CLI
# Basic analysis
ai-audit document.txt
# With detailed pattern breakdown
ai-audit --verbose document.txt
# JSON output
ai-audit --json document.txt > report.json
# Set threshold (0-100, default: 30)
ai-audit --threshold 50 document.txt
# Show only score (for scripting)
ai-audit --score-only document.txt
# Batch directory
ai-audit --batch ./docs/
# Pipeline: check then humanize
cat draft.md | ai-audit - --humanize
Python API
from ai_text_audit import Auditor
auditor = Auditor()
result = auditor.analyze("This groundbreaking innovation represents a pivotal moment...")
print(result.score) # 72.3 (0-100, higher = more AI-like)
print(result.verdict) # "likely_ai" | "possibly_ai" | "likely_human"
print(result.patterns) # List of detected patterns with counts
print(result.suggestions) # Rewrite suggestions per pattern
# Custom patterns
auditor = Auditor(patterns_file="my_patterns.yaml")
# Batch
results = auditor.analyze_dir("./docs/")
Output Examples
Terminal (default):
๐ฆ AI Text Audit โ document.md
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Score: 72.3 / 100 โ ๐ค Likely AI
Patterns detected:
โ ๏ธ em_dash (ร8) "โ" appears frequently, uncommon in casual writing
โ ๏ธ ai_vocab (ร12) Words like "crucial", "pivotal", "tapestry"
โก rule_of_three (ร5) "X, Y, and Z" structure overused
โก boast_language (ร3) "stands as a testament", "boasts"
๐ก promotional (ร2) "groundbreaking", "cutting-edge"
Suggestions:
โ Replace "โ" with ", " or "."
โ Swap "crucial" โ "important", "pivotal" โ "key"
โ Vary list structures beyond "A, B, and C"
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
JSON (--json):
{
"file": "document.md",
"score": 72.3,
"verdict": "likely_ai",
"word_count": 847,
"patterns": [
{"name": "em_dash", "count": 8, "weight": 1, "severity": "low", "description": "..."},
{"name": "ai_vocab", "count": 12, "weight": 1, "severity": "medium"}
],
"suggestions": ["Replace em-dashes with commas..."]
}
๐ง Detection Patterns
| Pattern | Weight | Example | Why It's AI |
|---|---|---|---|
em_dash |
1 | โ |
Overused in AI, rare in casual writing |
ai_vocab |
1 | "crucial", "tapestry", "delve" | Hallmark AI vocabulary |
rule_of_three |
0.5 | "A, B, and C" | AI loves triplets |
negative_parallelism |
2 | "It's not just X, it's Y" | Classic AI structure |
boast_language |
2 | "stands as a testament" | Promotional framing |
promotional |
2 | "groundbreaking", "revolutionary" | Buzzword density |
vague_attribution |
2 | "experts say", "many believe" | Fake authority |
collaborative_artifact |
3 | "I hope this helps!" | Chatbot leftovers |
filler |
1 | "It is important to note" | Academic filler phrases |
ing_superficial |
2 | "...ing, reflecting" | Superficial analysis pattern |
See docs/patterns.md for the full list of 22+ patterns.
๐ ๏ธ Configuration
Create ~/.ai-audit.yaml or pass --config:
# Custom patterns
patterns:
my_custom:
regex: "\\b(synergy|leverage|optimize)\\b"
weight: 1
description: "Corporate buzzwords"
# Thresholds
thresholds:
likely_ai: 60
possibly_ai: 30
# Ignore files
ignore:
- "*.min.js"
- "vendor/**"
๐๏ธ CI/CD Integration
GitHub Actions
- name: Check for AI writing
run: |
pip install ai-text-audit
ai-audit --threshold 50 --json . > audit.json
SCORE=$(jq '.score' audit.json)
if (( $(echo "$SCORE > 50" | bc -l) )); then
echo "::warning::Content score is $SCORE โ likely AI-generated"
fi
Pre-commit Hook
repos:
- repo: https://github.com/sudabg/ai-text-audit
rev: v1.0.0
hooks:
- id: ai-audit
args: ['--threshold', '40']
๐ฆ Installation
# PyPI (recommended)
pip install ai-text-audit
# From source
git clone https://github.com/sudabg/ai-text-audit.git
cd ai-text-audit
pip install -e .
# With optional dependencies
pip install ai-text-audit[full] # includes rich, pyyaml
๐ค Contributing
We welcome contributions! See CONTRIBUTING.md.
Good first issues:
- Add new detection patterns
- Improve existing pattern accuracy
- Add support for more languages (currently optimized for English + Chinese)
- Write tests for edge cases
๐ License
MIT License โ see LICENSE.
๐ Acknowledgments
- Pattern analysis based on Wikipedia's Signs of AI Writing
- Inspired by the need for transparent, offline AI content detection
- Built with ๐ฆ by ๅฐๅฉๅญ
๐ Roadmap
- v1.0.0 โ Core detection + CLI (this release)
- v1.1.0 โ Stylometric analysis (sentence length variance, vocabulary richness)
- v1.2.0 โ Perplexity-based detection (lightweight, local)
- v1.3.0 โ Multilingual support (Japanese, Korean, etc.)
- v2.0.0 โ Self-hosted API server mode
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_text_audit-1.0.0.tar.gz.
File metadata
- Download URL: ai_text_audit-1.0.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1490e88ba60104317c783416044215f06d0087502dcc9e9ec0fea6733acceeb7
|
|
| MD5 |
2abc3a5a306889ec5c792177fb55f6c2
|
|
| BLAKE2b-256 |
306da6ab5f2cb29640587c718caf91c7c1c2fe80c6d7a2471a571d8cece9d912
|
File details
Details for the file ai_text_audit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_text_audit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b1008440216e8e1174c17e1bff506a93d4806e19cc7fed0882224cef73aef1
|
|
| MD5 |
7bc6998334a43ef57372ef5da8316945
|
|
| BLAKE2b-256 |
551127f578a52209e6f0aa18c36d5e622409a39b327539434757e6c46905872c
|