Arabic Cleaner
A lightweight Python library for cleaning and normalizing Arabic text, designed for natural language processing (NLP) tasks such as Quranic text preprocessing.
Overview
Arabic text often contains diacritics, inconsistent character forms, and non-standard symbols that can negatively affect downstream NLP models. This library provides a simple and efficient pipeline to normalize and clean Arabic text before further processing.
Features
- Remove Arabic diacritics (harakat): Efficiently strips all Arabic harakat.
- Normalize common character variations: Standardizes variations of Alif, Hamza, etc.
- Filter non-Arabic characters: Removes unwanted symbols to ensure data purity.
- Simple and modular cleaning pipeline: Designed to be lightweight and easily integrated.
- Command-line interface (CLI) support: Quick processing directly from the terminal.
Installation
Install from PyPI:
pip install arabic-cleaner
For development (editable mode):
pip install -e .
Usage
Python
from arabic_cleaner import clean_text
text = "إِنَّ ٱللَّهَ غَفُورٌ رَّحِيمٌ"
result = clean_text(text)
print(result)
Output:
ان الله غفور رحيم
Command Line Interface
arabic-clean "إِنَّ ٱللَّهَ غَفُورٌ رَّحِيمٌ"
API
clean_text(text, remove_diacritics=True)
| Parameter | Type | Description |
|---|---|---|
text |
str |
Input Arabic text |
remove_diacritics |
bool |
Whether to remove diacritics (default is True) |
Example:
Input: إِنَّ ٱللَّهَ غَفُورٌ رَّحِيمٌ
Output: ان الله غفور رحيم
Project Structure
arabic_cleaner/
│── __init__.py
│── cleaner.py
│── normalizer.py
│── cli.py
Use Cases
- Arabic NLP preprocessing
- Quranic text normalization
- Speech-to-text postprocessing
- Machine learning data cleaning pipelines
License
MIT License
Metadata
Release files for arabic-cleaner 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| arabic_cleaner-0.1.0.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arabic_cleaner-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.6 kB
Release files / arabic_cleaner-0.1.0.tar.gz
| Download URL | arabic_cleaner-0.1.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eda3cbbe124e47637fc53a29edef3775d7ab2d7e4ac25277f80876533c957a74
|
|
BLAKE2b-256 checksum How to use checksums |
dfb8ee008c102cdc4be778a7781e0c7a97d40e784d3de4ce05f7c8ac786fc55f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / arabic_cleaner-0.1.0-py3-none-any.whl
| Download URL | arabic_cleaner-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
865d5b6babd64f7ac4e29d7d9042eb4d8c0cff2ced426bcd6012f6aefbc89921
|
|
BLAKE2b-256 checksum How to use checksums |
096b856e9997eb554bc8f2149aa034fa4d69e5ba18cad9bb27c98444482f808f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for arabic-cleaner 0.1.0
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.