Skip to main content

AraNorm

مكتبة بايثون احترافية شاملة لتطبيع النصوص العربية — فصحى ولهجات وعربيزي Production-grade Arabic text normalization — MSA, dialects, Arabizi & 45+ analyzers

PyPI version Python versions License: MIT Tests Code style: black

التثبيت · [البدء السريع](#-البدء السريع--quick-start) · التوثيق · CLI · المساهمة


English — AraNorm is a production-grade, dependency-free Arabic text normalization library for Python. It unifies orthographic normalization, dialect handling, Arabizi transliteration, stop-word processing, and 45+ linguistic analyzers behind one clean, typed, thoroughly tested API — replacing the usual pile of incompatible tools (PyArabic + CAMeL Tools + tnkeeh + custom regexes) with a single import.

العربية — AraNorm مكتبة بايثون احترافية لتطبيع النصوص العربية بلا أي تبعيات إلزامية. توحّد المكتبة التطبيع الإملائي، ومعالجة اللهجات، وتحويل العربيزي، ومعالجة الكلمات الوقفية، وأكثر من 45 محللاً لغوياً — خلف واجهة برمجية واحدة نظيفة ومُوثّقة الأنواع ومختبَرة باختبارات تتجاوز 2300 اختبار، لتستغني عن عدة مكتبات متفرقة وغير متوافقة.

┌────────────────────────────────────────────────────────────────┐
│                  ArabicNormalizationPipeline                   │
├────────────────────────────────────────────────────────────────┤
│  ContentCleaner   →   OrthographicNormalizer   →  DialectProc  │
│  (URLs, HTML,         (alef, hamza, diacritics,   (identify,   │
│   emojis, mentions,    tatweel, digits,            CODA, MSA)  │
│   hashtags, ...)       punctuation, ...)                       │
├────────────────────────────────────────────────────────────────┤
│            StopWordsStage  ·  45+ Analyzers  ·  CLI            │
└────────────────────────────────────────────────────────────────┘

✨ المزايا الرئيسية | Key Features

الميزة Feature
🚀 صفر تبعيات إلزامية — النواة تعمل ببايثون القياسي فقط Zero mandatory dependencies — pure standard-library core
🔤 تطبيع إملائي كامل: الألف، الهمزة، التاء المربوطة، التشكيل، الكشيدة، الأرقام، الترقيم Full orthographic normalization: alef, hamza, taa marbuta, diacritics, tatweel, digits, punctuation
🗣️ تحديد اللهجة heuristically لعشر مناطق (مصر، خليج، شام، عراق، مغارب، يمن، سودان...) Heuristic dialect identification for 10 regions
🔄 تحويل العربيزي إلى عربية (2na → أنا، 3nd → عند) Arabizi → Arabic transliteration
🛑 منظومة كلمات وقفية متقدمة: 8 لهجات + نطاقات + سياق + مجالات Advanced stop-words engine: 8 dialects + scopes + context + domains
📊 45+ محللاً: مشاعر، مشاعر ثمانية، جودة، مقروئية، ترابط، أسلوب، جناس، سجع، طباق... 45+ analyzers: sentiment, emotions, quality, readability, coherence, style, wordplay...
⚡ معالجة دفعات متوازية + بث تدفقي قابل للاستئناف بنقاط تفتيش Parallel batch processing + resumable streaming with checkpoints
🖥️ واجهة سطر أوامر بـ 44 أمراً + خادم HTTP مدمج 44-command CLI + built-in HTTP server
🧩 تكاملات جاهزة: pandas، scikit-learn، spaCy، NLTK، HuggingFace Ready integrations: pandas, scikit-learn, spaCy, NLTK, HuggingFace
🔒 شامل الأنواع (py.typed) + اختبارات عقود صارمة Fully typed (py.typed) + strict contract testing

📦 التثبيت | Installation

pip install aranorm

التبعيات الاختيارية | Optional extras:

pip install "aranorm[camel]"   # CAMeL Tools — تحديد لهجة بالنموذج (دقة >90%) على MADAR
pip install "aranorm[ml]"      # Transformers + PyTorch — تطبيع CODA/MSA عصبي
pip install "aranorm[full]"    # كل شيء | everything

ملاحظة | Note — النواة الكاملة (جميع الـ presets، الكلمات الوقفية، المحللات، الـ CLI، الخادم) تعمل بدون أي تبعية خارجية. التبعيات الاختيارية فقط لقدرات إضافية متخصصة. The complete core (all presets, stop words, analyzers, CLI, server) works with zero third-party dependencies. Extras only unlock specialized capabilities.

🚀 البدء السريع | Quick Start

1) التطبيع الأساسي | Basic normalization

from aranorm import ArabicNormalizationPipeline, PipelineConfig

config = PipelineConfig(
    preset="standard",        # "light" | "standard" | "deep" | "social_media"
    dialect_target="coda",    # "none" | "coda" | "msa"
    remove_diacritics=True,
    normalize_hamza=True,
    handle_arabizi=True,
)

pipeline = ArabicNormalizationPipeline(config)
result = pipeline.process("أهـــلاً شلونك حبيبي؟ https://t.co/abc 😊")

print(result.normalized_text)   # اهلا شلونك حبيبي?
print(result.dialect)           # GLF
print(result.dialect_confidence)
print(result.applied_steps)     # every applied processor, in order

2) الكلمات الوقفية | Stop words

from aranorm import ArabicNormalizationPipeline, PipelineConfig, StopWordsConfig

config = PipelineConfig(
    preset="standard",
    stop_words_config=StopWordsConfig(
        mode="remove",          # "remove" | "extract" | "highlight" | "count"
        scope="dialect_aware",  # "universal" | "msa_only" | "dialect_aware" | "custom"
        dialects={"EGY", "GLF"},
        preserve_negation=True, # keep لا، لم، لن
        remove_filler=True,     # strip يعني، والله، خلاص...
    ),
)
pipeline = ArabicNormalizationPipeline(config)
result = pipeline.process("أنا سعيد جداً اليوم")

print(result.stop_words_removed)   # سعيد اليوم
print(result.stop_words_found)     # {'أنا', 'جداً'}
print(result.stop_words_stats)     # counts, ratio, per-category breakdown

3) التحليل اللغوي | Linguistic analysis

from aranorm.analysis import (
    SentimentAnalyzer, KeywordExtractor, ArabicTextSummarizer,
    ArabicReadabilityAnalyzer, EmotionAnalyzer, StyleAnalyzer,
)
from aranorm.analysis.quality_score import analyze_quality

sentiment = SentimentAnalyzer().analyze("هذا المنتج رائع جداً")
print(sentiment.label, sentiment.score)          # positive 0.75

keywords = KeywordExtractor(top_n=5).extract("...")
print(keywords.top_keywords)

quality = analyze_quality("نص عربي للتحليل")
print(quality.score, quality.label, quality.suggestions)

4) الدفعات والتصدير | Batches & export

from aranorm.utils import BatchExporter

results = pipeline.process_batch(["نص أول", "نص ثاني"], n_workers=4)

exporter = BatchExporter(results)
exporter.to_csv("output.csv")
exporter.to_jsonl("output.jsonl")
exporter.to_json("output.json")

5) سطر الأوامر | Command line

$ aranorm normalize "أهـــلاً شلونك؟" --preset social_media
$ echo "نص للتحليل" | aranorm sentiment --json
$ aranorm batch --file input.txt --output out.jsonl --preset deep --workers 8
$ aranorm quality "النص العربي" --json
$ aranorm serve --port 8765        # HTTP normalization service

🎛️ الإعدادات المسبقة | Presets

Preset الاستخدام Use case
light تطبيع إملائي فقط دون حذف أي محتوى Orthographic pass only; nothing removed
standard التوازن الافتراضي: تنظيف روابط/بريد/HTML + تطبيع كامل Default balance: clean URLs/emails/HTML + full normalization
deep أقصى تنظيف + تقليص التكرارات الإنتاجية (ياااا → يا) Maximum cleaning + expressive repetition collapse
social_media للمنصات الاجتماعية: إزالة منشنات/إيموجي + كلمات وقفية تلقائية Social platforms: strip mentions/emojis + auto stop-words

كل خيار متاح كحقل مستقل في PipelineConfig — عدّل ما تشاء فوق أي preset. | Every option is an independent PipelineConfig field — override anything on top of any preset.

🆚 المقارنة مع المكتبات الأخرى | Comparison

Capability AraNorm CAMeL Tools PyArabic tnkeeh
Unified pipeline ✅ ❌ ❌ ❌
Dialect-aware ✅ 10 regions ✅ 5 (MADAR) ❌ ❌
Arabizi conversion ✅ ❌ ❌ ❌
Platform normalizers (X/WhatsApp) ✅ ❌ ❌ ❌
Stop-word engine ✅ 8 dialects + domains ❌ ❌ ❌
Analysis toolkit ✅ 45+ analyzers ✅ (ML) ❌ ❌
Batch + streaming ✅ resumable ❌ ❌ ❌
CLI ✅ 44 commands ✅ ❌ ❌
Zero mandatory deps ✅ ❌ (requires CAMeL) ✅ ✅

AraNorm لا تستبدل أدوات التعلم الآلي — بل تكمّلها: استخدم CAMeL Tools أو Transformers عبر التبعيات الاختيارية عندما تحتاج دقة النماذج، واستخدم نواة AraNorm السريعة دائماً.

AraNorm does not replace ML tooling — it complements it: use CAMeL Tools or Transformers through the optional extras when you need model accuracy, and use the fast AraNorm core everywhere else.

📚 التوثيق | Documentation

الدليل Guide المحتوى Contents
Getting Started البدء التثبيت، أول pipeline، الأساسيات Install, first pipeline, basics
Configuration الإعدادات كل حقول PipelineConfig موثقة Every PipelineConfig field
Presets & Processors المعالجات 48 معالجاً مشروحاً بالأمثلة All 48 processors explained
Stop Words الكلمات الوقفية الأوضاع، النطاقات، اللهجات، المجالات Modes, scopes, dialects, domains
Analysis Toolkit التحليل 45+ محللاً بالتفصيل All 45+ analyzers in depth
CLI Reference سطر الأوامر 44 أمراً بكل الخيارات All 44 commands
Streaming & Server البث والخادم جلسات قابلة للاستئناف + HTTP Resumable sessions + HTTP
Integrations التكاملات pandas، sklearn، spaCy، NLTK، HF pandas, sklearn, spaCy, NLTK, HF
API Reference المرجع الواجهة البرمجية الكاملة Complete API surface
Architecture المعمارية المراحل، السجل، العقود Stages, registry, contracts
Performance الأداء أرقام الإنتاجية والممارسات Throughput numbers & practices
FAQ أسئلة شائعة إجابات عملية Practical answers
Troubleshooting حل المشاكل تشخيص الأخطاء الشائعة Diagnosing common errors
Migration الترقية التغييرات بين الإصدارات Changes between versions

⚡ الأداء | Performance

أرقام مرجعية على جهاز محمول (Core i7، معالجة متتابعة) | Reference numbers on a laptop (Core i7, sequential):

Preset Throughput
light ~2,400 texts/s
standard ~1,650 texts/s
deep ~1,350 texts/s
social_media ~1,430 texts/s

شغّل القياس بنفسك | Run the benchmark yourself:

pip install -e ".[dev]" && python scripts/benchmark.py

🤝 المساهمة | Contributing

المساهمات مرحب بها! | Contributions are welcome!

git clone https://github.com/Alqudimi/AraNorm.git
cd AraNorm
pip install -e ".[dev]"
make verify     # format-check + lint + type-check + tests

انظر CONTRIBUTING.md للتفاصيل، وSECURITY.md لسياسة الإبلاغ عن الثغرات. See CONTRIBUTING.md for details and SECURITY.md for the vulnerability disclosure policy.

📄 الترخيص | License

MIT © 2024-2026 Abdulaziz Mohammed Alqudimi — انظر | see LICENSE.

📖 الاقتباس | Citation

إذا استخدمت AraNorm في بحث علمي، اقتبسها عبر ملف CITATION.cff: If you use AraNorm in academic work, please cite it via the CITATION.cff file:

@software{alqudimi_aranorm_2026,
  author  = {Alqudimi, Abdulaziz Mohammed},
  title   = {AraNorm: Production-grade Arabic Text Normalization},
  year    = {2026},
  url     = {https://github.com/Alqudimi/AraNorm},
  version = {1.15.1}
}

صُنع بعناية للغة العربية 🌙 Crafted with care for the Arabic language

Metadata

Release files for aranorm 1.15.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aranorm 1.15.1
File Size Uploaded Provenance Actions
aranorm-1.15.1.tar.gz 981.5 kB Without provenance Details for aranorm-1.15.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aranorm 1.15.1
File Interpreter ABI Platform Actions
aranorm-1.15.1-py3-none-any.whl Python 3 none any Details for aranorm-1.15.1-py3-none-any.whl

Total release size: 1.3 MB

Release files / aranorm-1.15.1.tar.gz

Download URL aranorm-1.15.1.tar.gz
Size 981.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2746e496ec037c42f24f28e7065d861ac9dcfe8b1e9ec642dcc6a5a8b531aad6
BLAKE2b-256 checksum
How to use checksums
d75de3febdf73cb78fec9c6a9e7b3057d28b17020577f3a311d4beb374280a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / aranorm-1.15.1-py3-none-any.whl

Download URL aranorm-1.15.1-py3-none-any.whl
Size 339.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34db965a9762979da3d4e22dec0bcdc7c1506ac1d8bb407aab981503c4ece4a4
BLAKE2b-256 checksum
How to use checksums
5f373571bd8ed440838ec3a13b53f04513dddc87454ed5fe3f3d937f22558f74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for aranorm 1.15.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page