Scan Arabic text for toxicity, hate speech, and spam. Dialect-aware. Fully offline.
Building Arabic platforms — social apps, chatbots, UGC — requires content moderation. Existing tools are English-first. sarih is Arabic-first with dialect awareness. It catches insults in Egyptian, Gulf, Levantine, and Moroccan, not just MSA.
No API keys. No network calls. No data leaves your machine.
pip install sarih# Check a single text
sarih check "text"
# Scan a JSONL file
sarih scan data.jsonl
# Clean a dataset (remove flagged content)
sarih clean data.jsonl --output clean.jsonl| Command | Description |
|---|---|
scan |
Scan a JSONL file for toxic content. Rich table output with filter hits, severity, and matched terms. |
check |
Check a single text string. Returns filter results with severity level. |
pipe |
Read from stdin for pipeline integration. Works with cat, jq, and other Unix tools. |
stats |
Show moderation statistics for a scanned file. Breakdown by filter, severity, and dialect. |
clean |
Remove or redact flagged content from a dataset. Use --output to write the cleaned file. |
explain |
Describe all 13 filters and 3 severity levels with examples. |
sarih runs 13 filters on every input:
| Filter | What it catches |
|---|---|
| Profanity | Swear words and vulgar language across all dialects |
| Hate Speech | Slurs and dehumanizing language targeting groups |
| Spam | Repetitive text, promotional patterns, keyword stuffing |
| Adult Content | Sexually explicit language and innuendo |
| Violence | Threats, incitement, graphic descriptions |
| PII | Phone numbers, emails, national IDs in Arabic text |
| Misinformation | Common health/political misinformation patterns |
| Level | Meaning |
|---|---|
| BLOCK | Must remove. Clearly toxic, dangerous, or illegal. |
| FLAG | Needs human review. Likely problematic but context-dependent. |
| REVIEW | Soft signal. May be fine, but worth a second look. |
sarih understands offensive terms across Arabic dialects:
- MSA (Modern Standard Arabic) — formal register
- Egyptian — مصري
- Gulf — خليجي
- Levantine — شامي
- Moroccan — مغربي
The same concept gets expressed differently in each dialect. sarih catches all of them.
- No API keys required
- No network calls
- No data leaves your machine
- Works in air-gapped environments
from sarih import moderate
result = moderate("text to check")
print(result.severity) # BLOCK, FLAG, or REVIEW
print(result.filters) # list of triggered filters
print(result.dialect) # detected dialectمقدمة من مجتمع الذكاء الاصطناعي السعودي للعرب أولا وللعالم أجمع
Brought to you by the Saudi AI Community — for Arabs first, and the world at large.
MIT — Musa the Carpenter
The Series: artok · bidi-guard · arabench · majal · khalas · safha · raqeeb · sarih