Canonicalization and Darija Representation - Bidirectional transliteration for Darija
Project description
CaDaR: Canonicalization and Darija Representation
Overview
CaDaR is a robust, FST-style (Finite State Transducer) transliteration library designed specifically for Darija (Moroccan Arabic). It provides bidirectional conversion between Arabic script and Latin (Romanized/Bizi) script, along with standardization capabilities for both scripts.
Key Features
- Bidirectional Transliteration: Convert seamlessly between Arabic and Latin scripts
- Intelligent Normalization: Handles noise, diacritics, and common variations
- Darija-Aware Processing: Respects Darija-specific linguistic patterns
- Intermediate Canonical Representation (ICR): Unified internal representation for accurate conversion
- High Performance: Written in Rust with Python bindings for optimal speed
- Extensible: Designed to support multiple Darija dialects (currently Moroccan)
Architecture
CaDaR uses a 6-stage pipeline with an Intermediate Canonical Representation (ICR):
Raw Input
↓
Stage 1: Script Detection
↓
Stage 2: Noise Cleaning & Normalization
↓
Stage 3: Tokenization (Darija-aware)
↓
Stage 4: Canonical Darija Representation (ICR)
↓
Stage 5: Target Script Generation
↓
Stage 6: Post-validation & Fixes
↓
Clean Standard Output
What is ICR?
The Intermediate Canonical Representation (ICR) is the core innovation of CaDaR. It's a script-independent, phonologically-grounded representation that:
- Abstracts away script-specific quirks
- Preserves Darija phonological distinctions
- Enables lossless round-trip conversions
- Allows for consistent normalization across scripts
Installation
From PyPI
pip install cadar
From Source
Prerequisites
- Python 3.8 or higher
- Rust toolchain (for building from source)
- Maturin (for Python packaging)
Build and Install
# Clone repository
git clone https://github.com/Oit-Technologies/CaDaR.git
cd CaDaR
# Install Maturin
pip install maturin
# Build and install in development mode
maturin develop
# Or build a wheel for distribution
maturin build --release
Usage
Python API
CaDaR provides four main functions that match the requested API:
1. ara2bizi() - Arabic to Latin/Bizi
import cadar
result = cadar.ara2bizi("سلام", darija="Ma")
print(result)
# Output: "slam"
2. bizi2ara() - Latin/Bizi to Arabic
import cadar
result = cadar.bizi2ara("salam", darija="Ma")
print(result)
# Output: "سلام"
3. ara2ara() - Arabic Standardization
import cadar
result = cadar.ara2ara("أنَا", darija="Ma")
print(result)
# Output: "انا"
4. bizi2bizi() - Latin/Bizi Standardization
import cadar
result = cadar.bizi2bizi("salaaaam", darija="Ma")
print(result)
# Output: "salam"
Convenience Functions
CaDaR also provides convenience functions with auto-detection:
import cadar
# Auto-detect and transliterate
text = "سلام" # Arabic
result = cadar.transliterate(text, target="latin", darija="Ma")
print(result) # "slam"
# Auto-detect and standardize
text = "salaaaam"
result = cadar.standardize(text, script="auto", darija="Ma")
print(result) # "salam"
CaDaR Class
For multiple operations, use the CaDaR class:
import cadar
# Create processor
processor = cadar.CaDaR(darija="Ma")
# Use for multiple operations
texts = ["سلام", "كيفاش", "بزاف"]
for text in texts:
result = processor.ara2bizi(text)
print(f"{text} → {result}")
Version History
See CHANGELOG.md for details.
License
CaDaR is licensed under the Apache License 2.0.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Links
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 Distributions
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 cadar-0.1.13.tar.gz.
File metadata
- Download URL: cadar-0.1.13.tar.gz
- Upload date:
- Size: 457.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01a72f6e8635490c0dda66576d82940172f7d2355353bb1182ea2cbd9049aae7
|
|
| MD5 |
054f990da190f50ab0dfbcbd2fefefe0
|
|
| BLAKE2b-256 |
34ca8a3382b3f1e2e22fb60bd9fa737466ee95facce6f262fa880a8180ace9bd
|
File details
Details for the file cadar-0.1.13-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: cadar-0.1.13-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 851.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf38232b2a03878d792723f5cb5102291fbf7d6cad85c8c3f75ef5cfc60e2b92
|
|
| MD5 |
c4a391c6818482c0de90e0b35258a88a
|
|
| BLAKE2b-256 |
8d636d28dc9e824a65e7b84d77605f133cbcf8b8e598883d6dae88ee33fd7602
|
File details
Details for the file cadar-0.1.13-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cadar-0.1.13-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 961.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4adde6409ff6782b9b5aebed3c6058a89b11f524cc616591868230640d324d47
|
|
| MD5 |
65b35f8a0ec13b294bd7e2bedc852498
|
|
| BLAKE2b-256 |
5dcea8db44800fedf32977c95ed407af3746dea67ed6eeb672eb2c425f2f11fe
|
File details
Details for the file cadar-0.1.13-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: cadar-0.1.13-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 844.4 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53314372f4c8549099820d57779f55a599c36180297897c7d6395dfffd45183d
|
|
| MD5 |
92bde0c39fe07fbb206388e393d751ef
|
|
| BLAKE2b-256 |
eea51740ccb84a4c03ab8e8e1908a96600b2be765af2ce408e9f819069f4a32a
|
File details
Details for the file cadar-0.1.13-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: cadar-0.1.13-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 850.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef8737ccd93eff53036b2fcc2b74e14ace7b6fa0f81f38e01749c8aaf5e1b7ad
|
|
| MD5 |
d2747af54ba336af6905a97b20d10ebf
|
|
| BLAKE2b-256 |
d8dcb25a9457e132de8b1742c8fe5b792c38c5483383d01c97d385ff21302967
|
File details
Details for the file cadar-0.1.13-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cadar-0.1.13-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 960.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d463f2f5cfedda6932b54f7a2189264f75eee42467ffa05905a1819016f62ee
|
|
| MD5 |
b02cccd92d09db065deb99b6898898e8
|
|
| BLAKE2b-256 |
28222fe6456e575378a7ea130d518bb8c22f5df6d6e370552d460c4cf60f1d91
|
File details
Details for the file cadar-0.1.13-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: cadar-0.1.13-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 846.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26e3fa555c723e9ddff6725332888d8dbe53564e80060a6dd21b5a872fbed532
|
|
| MD5 |
3b47f86d0d41d20356e81cd5515ac946
|
|
| BLAKE2b-256 |
94dca19555ba1fc8ec83bbd6167a1e107831c1b0aa778ed6bfb785ffdd08615a
|
File details
Details for the file cadar-0.1.13-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: cadar-0.1.13-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 851.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
808ea76dc2bba43ba94316c57bf3fc9e640b8ff68244e02f97dc8af07c495315
|
|
| MD5 |
396198115c1276707300391551a139e7
|
|
| BLAKE2b-256 |
8319351a7855407748e712d9b7df20c89f6b2a5c2c28d6f6db0b5f30ec0bd718
|
File details
Details for the file cadar-0.1.13-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cadar-0.1.13-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 960.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfb2e7002cc892501fa46035443e60ad6dba1a2fbcc8096f568d4b73bf464db4
|
|
| MD5 |
3958bdd3384c31ccd6c5cb754855c0f2
|
|
| BLAKE2b-256 |
3b322580a728a03e7c7ad6520ad3f5753851f99914e4cea451e8b6921a1e7c7d
|
File details
Details for the file cadar-0.1.13-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: cadar-0.1.13-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 846.5 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7638b55b89bef158e72fe8fa6a56c2247631edd5d4bc66da52d5f433bccbc6af
|
|
| MD5 |
5437eb322ec1bf6d5a64987cfccdc4a8
|
|
| BLAKE2b-256 |
50aa8b349f681c766315052a5d9eb3c09db87e40156de8a54166202a138904ee
|
File details
Details for the file cadar-0.1.13-cp39-cp39-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cadar-0.1.13-cp39-cp39-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 960.9 kB
- Tags: CPython 3.9, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c528e1a5ec4d583abb55243c286fdc9ce16aec14a169fa3ab91b6f4d96298d78
|
|
| MD5 |
a68954546d47562a24264a948f5f8e11
|
|
| BLAKE2b-256 |
11511d06a623f7fd9656ecabbb84e08766738e4bbcbdf614cbb3d401e387a942
|
File details
Details for the file cadar-0.1.13-cp38-cp38-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cadar-0.1.13-cp38-cp38-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 960.9 kB
- Tags: CPython 3.8, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25e1229b34a469240b907f9a0d431f976f1b75e42bb63ede3d9f15cb0580597e
|
|
| MD5 |
2d7e2bb0beb606e13734a02686a6bf2c
|
|
| BLAKE2b-256 |
cb7eb385da2d6d063bdcd06757caf042a4030f8e116378ab28ac7c93629e62ec
|