Skip to main content

Fix Arabic text rendering across code, AI agents, and designs.

Project description

arabic-fix

Fix Arabic text rendering across code, AI agents, and designs.

License: MIT Python 3.9+ Tests

One library, one CLI, one system prompt. Letter-shaping, BiDi reordering, Unicode normalization, and a 3-section prompt template for any LLM. Arabic flows through terminals, AI agents, log files, and PDFs the way it should.

pip install arabic-fix
from arabic_fix import fix
print(fix("User 42 من الرياض at 09:30"))
# → a properly shaped, correctly ordered, NFC-normalized string
# CLI
cat arabic.txt | arabic-fix
arabic-fix --check file.txt          # CI mode: exit non-zero if changes needed
# AI agent: paste one of the 3 sections from agents/system_prompt.md
#   A · Read Arabic    — for agents that parse / summarize / classify
#   B · Write Arabic   — for agents that emit to terminal / log / email
#   C · Design Arabic  — for HTML / CSS / Tailwind / design tokens

Why

  • Letter shapingا ب ت (isolated forms) become اتصال (connected) via Unicode Presentation Forms-B.
  • BiDi orderUser 42 من الرياض ends up with 42 on the visual left and Arabic letters in their connected form, per UAX #9.
  • Tashkeel preserved — diacritics survive; مَرْحَبًا round-trips intact.
  • Logical CSS onlymargin-inline-start, never margin-left.
  • Real Arabic fonts — Tajawal, IBM Plex Sans Arabic, Noto Naskh Arabic in priority order; never Inter or Roboto.

What's in the box

Path What it is
arabic_fix/ Python library: fix(), shape(), reorder(), normalize()
agents/system_prompt.md 3 splice-in-able sections for any LLM
agents/eval_cases.md 15 cases to verify the system prompt works
designs/tokens.json 73 design tokens (W3C DTCG), CSS / Tailwind / Figma exports
examples/sample-arabic-page.html 5 Arabic surfaces using the tokens
docs/roadmap.md v0.2 → v0.6 milestones

Verify

pytest -q                          # 169 tests
mypy arabic_fix                    # strict, clean
python designs/validate_tokens.py  # 73 token schema check

License

MIT — see LICENSE. The brand arabic-fix is locked until v1.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arabic_fix-0.4.0.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arabic_fix-0.4.0-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file arabic_fix-0.4.0.tar.gz.

File metadata

  • Download URL: arabic_fix-0.4.0.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for arabic_fix-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b41459597241bfa2db940ca3beffb3395eb6f21124653e3d5e0d3ae1f87ca674
MD5 bab001564c638b49c074b50cd3d8d3b8
BLAKE2b-256 da00027444611ba48a4ffb0282c05ab66a64815089df89e15fe182a57ec38829

See more details on using hashes here.

File details

Details for the file arabic_fix-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: arabic_fix-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for arabic_fix-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d2cb1e187207ca13090a9f6928ba3db72915e4deccf68e2b619e49760da2826
MD5 919e6b23ae618a54a2c5c4b7431ebd0d
BLAKE2b-256 930e1ae3f1434012b0d21c9153b93fbf4c7019759494526aebe2d9abb29b67c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page