مكتبة شاملة لمعالجة النصوص العربية: تطبيع، تصحيح العرض (reshaping/bidi)، وتكامل مباشر مع matplotlib للرسوم البيانية.
Project description
arabikit
مكتبة بايثون شاملة لمعالجة النصوص العربية: تطبيع، إصلاح عرض (reshaping + bidi)، وتكامل مباشر مع matplotlib للرسوم البيانية.
لماذا arabikit؟
مطوّر بايثون الذي يتعامل مع نصوص عربية غالبًا يحتاج يجمع عدة مكتبات متفرقة
(arabic_reshaper، python-bidi، تطبيع يدوي) بدل مكتبة واحدة متكاملة وموثقة.
arabikit تجمع كل هذا بواجهة بسيطة.
التثبيت
# التطبيع الأساسي فقط (لا اعتماديات إضافية على الإطلاق)
pip install arabikit
# مع دعم إصلاح عرض النص (reshaping + bidi)
pip install arabikit[display]
# مع دعم الرسوم البيانية (matplotlib + reshaping + bidi)
pip install arabikit[charts]
الاستخدام
تطبيع النصوص
from arabikit import normalize_text
normalize_text("إلـــى الْأَمَامِ")
# 'الي الامام'
# تعطيل خيار معيّن، مثلًا الإبقاء على الألف المقصورة كما هي:
normalize_text("إلى", alef_maqsura=False)
# 'الى'
الدوال المتاحة: remove_tashkeel، remove_tatweel، normalize_hamza
(توحيد أشكال الهمزة فقط: أ إ آ ؤ ئ)، normalize_alef_maqsura
(توحيد ى مع ي بشكل منفصل عن الهمزة)، و normalize_text التي تجمعها كلها.
إصلاح عرض النص (لبيئات لا تدعم العربية)
يحتاج pip install arabikit[display].
from arabikit import fix_arabic_display
fix_arabic_display("مرحبا بالعالم")
تكامل مع matplotlib
يحتاج pip install arabikit[charts].
import matplotlib.pyplot as plt
from arabikit.charts import fix_axis_labels
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 5, 6])
fix_axis_labels(ax, xlabel="الأشهر", ylabel="المبيعات", title="تقرير المبيعات")
plt.show()
سطر الأوامر
arabikit clean input.txt -o output.txt
arabikit clean input.txt --no-tashkeel
arabikit clean input.txt --no-alef-maqsura
arabikit --version
ملاحظة حول الاعتماديات
normalize_text وبقية دوال arabikit.normalize لا تحتاج أي مكتبة خارجية.
أما fix_arabic_display (ووحدة charts) فتُستورد بشكل كسول ولا تحتاج
arabic-reshaper/python-bidi/matplotlib إلا عند استدعائها فعليًا.
الاختبارات
pip install -e ".[dev,charts]"
pytest
الترخيص
MIT
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 arabikit-0.2.0.tar.gz.
File metadata
- Download URL: arabikit-0.2.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f80ce25f2ca0c45f7bf560456b0743b350d2e6aef53acb57155adef3cc5eb833
|
|
| MD5 |
4d62a0d59da86c086c699c1d9e8f796d
|
|
| BLAKE2b-256 |
a86f53fea4a51ebb21340a7a66066fdc97972b24809a86e204e12979969665a9
|
File details
Details for the file arabikit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: arabikit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c7482a39b7ec2a950c967045a6ba93f6dc73b7ba1d5f88c2e0fa0ca18047ac
|
|
| MD5 |
47c979db7826220d8ddf7ac67b7488c6
|
|
| BLAKE2b-256 |
59509deeceb77d44e9dcf910729683779cd08ccc66c7000cf9d761e5a7bc19d6
|