Skip to main content

araclean

CI PyPI version Python versions License: MIT Ruff Docs Hugging Face Space

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/:

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

MIT

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)

Source distribution for araclean 0.3.0
File Size Uploaded
araclean-0.3.0.tar.gz 314.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for araclean 0.3.0
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.0

2 release files

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