Downloads · 30 days
0
Kandil7/alim-arabic-models
alim-arabic-models is a machine learning model from Kandil7. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Character-level neural heads from the ALIM neuro-symbolic Arabic project: two specialist diacritizers (12M params each, BiLSTM + multi-head attention, three heads: vowel / shadda / tanwin) and one 16-class Arabic mete…
Downloads · 30 days
0
Access
Public
Updated Sep 9, 2026
Repo size
99 MB
Likes
0
Public
Click a slice to open those files.
.safetensors99 MB · 100%
From the Hugging Face model README
Character-level neural heads from the ALIM neuro-symbolic Arabic project: two specialist diacritizers (12M params each, BiLSTM + multi-head attention, three heads: vowel / shadda / tanwin) and one 16-class Arabic meter classifier (char-embedding + 2-layer BiLSTM). Weights are safetensors; every number below is measured on fixed eval sets with seed 42 — see Evaluation.
alim-arabic-models/
├── README.md # this file
├── inference_example.py # self-contained CPU inference (torch + safetensors)
├── diac-prose/ # prose diacritizer — prose DER 12.9%
│ ├── model.safetensors, config.json, README.md
├── diac-verse/ # verse diacritizer — verse DER 11.7%
│ ├── model.safetensors, config.json, README.md
└── meter-16/ # 16 canonical buhur — test 79.6%, gold-327 84.4%
├── model.safetensors, config.json, vocab.json, idx_to_meter.json, README.md
A single 12M model cannot serve both domains (measured share curve, same 10-epoch budget, seed 42):
| Poetry share | Prose DER (clean-2k) | Verse DER (313 bayts) |
|---|---|---|
0% → diac-prose | 12.9% | 45.8% |
| 35% | 15.0% | 24.6% |
100% → diac-verse | 45.9% | 11.7% |
Each domain without its data collapses to ~46%. Route by source: poetry
corpora → diac-verse, everything else → diac-prose. Per-class recall
(prose / verse): bare 93/95%, fatha 88/89%, damma 88/81%, kasra 90/89%,
sukun 90/91%, tanwin 83/86%, shadda 94/95%.
# pip install torch safetensors
import sys
sys.path.insert(0, ".")
from inference_example import vocalize, predict_meter
print(vocalize("diac-prose", "العلم نور يهدي صاحبه الى الخير"))
print(predict_meter("meter-16", "قفا نبك من ذكرى حبيب ومنزل", "بسقط اللوى بين الدخول فحومل"))
Tokenizer (both diacritizers): ord(char) % 50000 per Arabic letter;
diacritics and spaces carry no ids; pad id 0. Meter input: "sadr | ajuz",
first 128 chars, char ids from meter-16/vocab.json.
diac-prose ← diac_mix100k · diac-verse ←
diac_poetryonly · meter-16 ← meter16w. Source: ALIM project
(neuro-symbolic Arabic: sarf/nahw/prosody rules + neural heads).