Skip to content

Moshe-ship/sarih

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sarih (صريح) — Arabic Content Moderator

Scan Arabic text for toxicity, hate speech, and spam. Dialect-aware. Fully offline.

Why

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.

Install

pip install sarih

Quick Start

# 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

Commands

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.

Filters

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

Severity Levels

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.

Dialect Aware

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.

Fully Offline

  • No API keys required
  • No network calls
  • No data leaves your machine
  • Works in air-gapped environments

As a Library

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.

License

MIT — Musa the Carpenter


The Series: artok · bidi-guard · arabench · majal · khalas · safha · raqeeb · sarih

About

Arabic Content Moderator — scan text for toxicity, hate speech, spam. Dialect-aware. Fully offline.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages