egyptian-arabizi-franco
Egyptian Arabizi (Franco-Arabic, "Franco") → Arabic, offline, on a CPU:
ezayak 3amel eh → ازيك عامل ايه
3andy el meeting bokra → عندي الmeeting بكرة
A small character-level transformer (about 3M parameters, bundled with the package, no internet needed) plus a
few rules around it: English work and tech words stay in Latin letters, numbers, punctuation and emojis pass
through, and stretched letters (awyyyy) are shortened before conversion.
Install
pip install egyptian-arabizi-franco
Python 3.9+. Depends only on onnxruntime and numpy (no PyTorch).
Use
from egyptian_arabizi_franco import convert
convert("ezayak 3amel eh") # 'ازيك عامل ايه'
convert(["yalla bina", "el meeting bokra"]) # a list in, a list out (faster than one by one)
The first call loads the model (a second or so); later calls reuse it. For more control, keep your own converter:
from egyptian_arabizi_franco import Converter
c = Converter(threads=2) # limit CPU threads
c.convert("msh fahem 7aga")
raw = Converter(raw=True) # the model alone, without the rules around it
From the command line:
egyptian-arabizi-franco "ezayak 3amel eh"
cat chat.txt | egyptian-arabizi-franco # one line in, one line out
In a FastAPI backend
from fastapi import FastAPI
from pydantic import BaseModel, Field
from egyptian_arabizi_franco import Converter
app = FastAPI()
converter = Converter() # load the model once, when the server starts
class ConvertRequest(BaseModel):
texts: list[str] = Field(max_length=100) # e.g. {"texts": ["ezayak 3amel eh", "eh el a5bar"]}
@app.post("/convert")
def convert(req: ConvertRequest): # plain def: FastAPI runs it in a worker thread
return {"arabic": converter.convert([t[:500] for t in req.texts])}
pip install egyptian-arabizi-franco fastapi uvicorn
uvicorn main:app
curl -X POST localhost:8000/convert -H "Content-Type: application/json" -d '{"texts": ["eh el a5bar"]}'
# {"arabic": ["ايه الاخبار"]}
Tips for a backend:
- Create the
Converteronce, at module level or at startup. Loading it takes around a second, so doing it on every request would add that to each one. - Use
def, notasync def, for the endpoint. The conversion is CPU work, so FastAPI should run it in its thread pool instead of blocking the event loop. One converter can be used from several threads at once. - Send lists when you have several texts. One call with 50 texts is much faster than 50 calls with one.
- Limit the input size (the example allows 100 texts of up to 500 characters) so one huge request can't hog the CPU.
- Speed is a rough guide, not a promise: in our tests on an ordinary laptop CPU, a short sentence took somewhere around 50 to 100 ms on its own, and less per sentence when sent in a batch. Your numbers will depend on the machine, the text length and how many requests arrive together, so measure on your own server.
How good is it?
On held-out, human-written Egyptian Arabizi: 75% of words and 41% of whole sentences exactly right
(the 0.1.x model, with the rules above). Typical mistakes are long vowels (fahem → فهم instead of فاهم) and letters Arabizi writes the
same way (s for both س and ص). Results, charts and the training code:
github.com/BackendNeuron/egyptian-arabizi-franco.
Licence
MIT. The model was pre-trained on text from the Egyptian Arabic Wikipedia (CC BY-SA 4.0).
Metadata
Release files for egyptian-arabizi-franco 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| egyptian_arabizi_franco-0.1.1.tar.gz | 12.1 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| egyptian_arabizi_franco-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 MB
Release files / egyptian_arabizi_franco-0.1.1.tar.gz
| Download URL | egyptian_arabizi_franco-0.1.1.tar.gz |
|---|---|
| Size | 12.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a101a06bc70bf64809c39264cdec6f98a2bf04513d782275cf5409a2c71a271b
|
|
BLAKE2b-256 checksum How to use checksums |
f6f434a22f49668bfbac3e34b877056e54cd58aeaf0dcc665b71a414d36f6718
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / egyptian_arabizi_franco-0.1.1-py3-none-any.whl
| Download URL | egyptian_arabizi_franco-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6334125aac6dcdc752faef71f55c8a0ad72455390db19114a0327e9ed2b2bafc
|
|
BLAKE2b-256 checksum How to use checksums |
6e6468f585dcda1f6a376dd1812b8d4b9e30c170cf656a896ec0768dc1a2464f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for egyptian-arabizi-franco 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.