Arabic text cleaning and normalization
Project description
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
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 arabic_cleaner-0.1.0.tar.gz.
File metadata
- Download URL: arabic_cleaner-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda3cbbe124e47637fc53a29edef3775d7ab2d7e4ac25277f80876533c957a74
|
|
| MD5 |
69216ef24ace86425535a221155fa9bb
|
|
| BLAKE2b-256 |
dfb8ee008c102cdc4be778a7781e0c7a97d40e784d3de4ce05f7c8ac786fc55f
|
File details
Details for the file arabic_cleaner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: arabic_cleaner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865d5b6babd64f7ac4e29d7d9042eb4d8c0cff2ced426bcd6012f6aefbc89921
|
|
| MD5 |
e83691d697042b7a1ce10cd9a36343c7
|
|
| BLAKE2b-256 |
096b856e9997eb554bc8f2149aa034fa4d69e5ba18cad9bb27c98444482f808f
|