araclean
Arabic text normalization and cleaning — pure-Python, composable, reproducible, offset-preserving.
Status: pre-release (
0.x). The normalization core is tested, but the API may still change before 1.0.
araclean is non-destructive by default: the bare call is lossless encoding repair
(Unicode form, presentation forms, tatweel, bidi/zero-width characters, look-alike
letters, whitespace) and never silently strips tashkeel or folds letters. Everything
lossy is opt-in through named, serializable profiles (SEARCH, ML, SOCIAL,
CLASSICAL), so the exact preprocessing a corpus went through can be published and
reproduced.
>>> from araclean import normalize
>>> normalize("على قدر أهل العـــزم") # default: remove tatweel
'على قدر أهل العزم'
>>> normalize("عَلَى قَدْرِ أَهْلِ العَزْمِ", profile="search")
'علي قدر اهل العزم'
For span-level work — RAG citation, NER projection — apply_aligned returns the normalized
text and a map back to every original position:
>>> from araclean import Pipeline, RemoveTatweel, FoldAlef
>>> pipe = Pipeline([RemoveTatweel(), FoldAlef()])
>>> normalized, omap = pipe.apply_aligned("أحمـد")
>>> normalized
'احمد'
>>> omap.to_original((0, 4)) # where does the whole normalized word sit in the original?
(0, 5)
See the map in action in the live Hugging Face Space, or read the offset-preserving normalization guide.
Documentation
Full documentation lives at https://mhdmartini.github.io/araclean/:
- Getting started — install, first call, choosing a profile.
- Profiles — every step each profile applies, lossless vs lossy (generated from the code).
- Guides — the CLI, pandas & polars, tuning and composing pipelines, custom steps, reproducibility, and stopwords.
- Why araclean — the problem it solves and its design choices.
- API reference and CLI reference.
CI runs every Python example as a doctest and checks generated pages (profiles, glossary, and CLI reference) against the code.
Install
pip install araclean
Optional extras:
pip install "araclean[cli]" # command-line interface
pip install "araclean[pandas]" # pandas Series accessor
pip install "araclean[polars]" # polars accessor
pip install "araclean[all]" # everything
The core install is lean: it requires only pydantic v2 — no compiler, Java, or data download.
Development
This project uses uv for environments and pre-commit for the quality gate.
uv sync # create the dev environment
uv run pre-commit install # wire up the pre-commit hooks
uv run pre-commit run --all-files
The gate runs ruff, mypy --strict, pyright, pytest, and cspell
(canonical Arabic terminology per GLOSSARY.md).
Commits & versioning
The version and changelog are derived from commit messages by
Commitizen — see
ADR-0008. Every commit must be a
Conventional Commit; the format is enforced by a
commit-msg hook (wired by uv run pre-commit install) and in CI on every PR.
feat(steps): add RemoveTashkeel step # → minor bump
fix(pipeline): preserve step order # → patch bump
feat(api)!: rename normalize() argument # breaking → minor (we are pre-1.0)
feat bumps the minor, fix/others the patch, and a breaking change (! or a BREAKING CHANGE:
footer) the minor — the project stays in 0.x until 1.0 is declared. To cut a release:
uv run cz bump # compute the bump, update pyproject.toml + uv.lock + CHANGELOG.md, tag vX.Y.Z
uv run cz changelog # preview release notes without bumping
Never hand-edit [project].version — Commitizen owns it.
License
Metadata
Release files for araclean 0.3.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 | |
|---|---|---|---|
| araclean-0.3.0.tar.gz | 314.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| araclean-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 394.8 kB
Release files / araclean-0.3.0.tar.gz
| Download URL | araclean-0.3.0.tar.gz |
|---|---|
| Size | 314.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68fcaaed7eff4509d3fea1e57f31e5301878db6cd49fab7278f1937ceb1b5e91
|
|
BLAKE2b-256 checksum How to use checksums |
6e109e61a47972f71e7ee63aef7d771303a6e2e7429faf8d2fe9414d464545bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logRelease files / araclean-0.3.0-py3-none-any.whl
| Download URL | araclean-0.3.0-py3-none-any.whl |
|---|---|
| Size | 80.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39c978bb638d98c8434acb002b328c7be6bda84642990cc1fae659df7c54b3ee
|
|
BLAKE2b-256 checksum How to use checksums |
736e077107968c7077553e25932922e7de23cb7d53ab976ebffae71a7c78ff98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency log