Text Generation
fastText
Moroccan Arabic
wikilangs
nlp
tokenizer
embeddings
n-gram
markov
wikipedia
feature-extraction
sentence-similarity
tokenization
n-grams
markov-chain
text-mining
babelvec
vocabulous
vocabulary
monolingual
family-arabic
Instructions to use wikilangs/ary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- fastText
How to use wikilangs/ary with fastText:
from huggingface_hub import hf_hub_download import fasttext model = fasttext.load_model(hf_hub_download("wikilangs/ary", "model.bin")) - Notebooks
- Google Colab
- Kaggle
| language: ary | |
| language_name: Moroccan Arabic | |
| language_family: arabic | |
| tags: | |
| - wikilangs | |
| - nlp | |
| - tokenizer | |
| - embeddings | |
| - n-gram | |
| - markov | |
| - wikipedia | |
| - feature-extraction | |
| - sentence-similarity | |
| - tokenization | |
| - n-grams | |
| - markov-chain | |
| - text-mining | |
| - fasttext | |
| - babelvec | |
| - vocabulous | |
| - vocabulary | |
| - monolingual | |
| - family-arabic | |
| license: mit | |
| library_name: wikilangs | |
| pipeline_tag: text-generation | |
| datasets: | |
| - omarkamali/wikipedia-monthly | |
| dataset_info: | |
| name: wikipedia-monthly | |
| description: Monthly snapshots of Wikipedia articles across 300+ languages | |
| metrics: | |
| - name: best_compression_ratio | |
| type: compression | |
| value: 4.172 | |
| - name: best_isotropy | |
| type: isotropy | |
| value: 0.8215 | |
| - name: best_alignment_r10 | |
| type: alignment | |
| value: 0.2420 | |
| - name: vocabulary_size | |
| type: vocab | |
| value: 79667 | |
| generated: 2026-03-02 | |
| # Moroccan Arabic — Wikilangs Models | |
| Open-source tokenizers, n-gram & Markov language models, vocabulary stats, and word embeddings trained on **Moroccan Arabic** Wikipedia by [Wikilangs](https://wikilangs.org). | |
| 🌐 [Language Page](https://wikilangs.org/languages/ary/) · 🎮 [Playground](https://wikilangs.org/playground/?lang=ary) · 📊 [Full Research Report](RESEARCH_REPORT.md) | |
| ## Language Samples | |
| Example sentences drawn from the Moroccan Arabic Wikipedia corpus: | |
| > آيت ميلك جماعة ترابية قروية كاينة في إقليم اشتوكة آيت باها، جهة سوس ماسة، ساكنين فيها نسمة، على حسب الإحصاء العام ويب | |
| > أورو هي لفلوس لي كاتخدًم بزاف ديال الدول ديال الاتحاد الأوروپي. هاد الدول تافقو يخدًمو الأورو مبعد المعاهدة ديال ماستريخت عام شوف حتى الاتحاد الأوروپي مصادر | |
| > إيلبا (ب ، إيصولا د إيلبا) هي واحد الجزيرة تابعة للطاليان و تيسكن فيها تقريبا 30.000 واحد. جات ف البحر البيض المتوسط مابين طوسكانيا و كورسيكا. مصادر ف الطاليان ݣزيرة | |
| > حرب كردستان لعراق هي واحد الحرب ف كردستان لعراق سالات بالربح ديال لعراق. بدات ف عام و سالات ف و ربح فيها لعراق مين كان حاكمو حزب لبعث. مصادر | |
| > الدارجة التطوانية هي الدارجة لي كيهضرو الناس د المدينة د تطوان و النواحي ديالا، و عندها تأثيرات من العربية د الأندلس و اللهجة الجبلية لي قريبا لها. مصادر د داريجة | |
| ## Quick Start | |
| ### Load the Tokenizer | |
| ```python | |
| import sentencepiece as spm | |
| sp = spm.SentencePieceProcessor() | |
| sp.Load("ary_tokenizer_32k.model") | |
| text = "قريش هيا قبيلة ؤلا أجموع قبلي لي، علا حساب لمصادر لإسلامية، كانت ف مكة ؤ كاينتام" | |
| tokens = sp.EncodeAsPieces(text) | |
| ids = sp.EncodeAsIds(text) | |
| print(tokens) # subword pieces | |
| print(ids) # integer ids | |
| # Decode back | |
| print(sp.DecodeIds(ids)) | |
| ``` | |
| <details> | |
| <summary><b>Tokenization examples (click to expand)</b></summary> | |
| **Sample 1:** `قريش هيا قبيلة ؤلا أجموع قبلي لي، علا حساب لمصادر لإسلامية، كانت ف مكة ؤ كاينتام…` | |
| | Vocab | Tokens | Count | | |
| |-------|--------|-------| | |
| | 8k | `▁ق ريش ▁هيا ▁قبيلة ▁ؤلا ▁أج موع ▁ق بلي ▁لي … (+19 more)` | 29 | | |
| | 16k | `▁قريش ▁هيا ▁قبيلة ▁ؤلا ▁أج موع ▁ق بلي ▁لي ، … (+16 more)` | 26 | | |
| | 32k | `▁قريش ▁هيا ▁قبيلة ▁ؤلا ▁أجموع ▁ق بلي ▁لي ، ▁علا … (+15 more)` | 25 | | |
| | 64k | `▁قريش ▁هيا ▁قبيلة ▁ؤلا ▁أجموع ▁قبلي ▁لي ، ▁علا ▁حساب … (+14 more)` | 24 | | |
| **Sample 2:** `آيت ميلك جماعة ترابية قروية كاينة في إقليم اشتوكة آيت باها، جهة سوس ماسة، ساكنين…` | |
| | Vocab | Tokens | Count | | |
| |-------|--------|-------| | |
| | 8k | `▁آيت ▁ميل ك ▁جماعة ▁ترابية ▁قروية ▁كاينة ▁في ▁إقليم ▁اشتوكة … (+16 more)` | 26 | | |
| | 16k | `▁آيت ▁ميل ك ▁جماعة ▁ترابية ▁قروية ▁كاينة ▁في ▁إقليم ▁اشتوكة … (+16 more)` | 26 | | |
| | 32k | `▁آيت ▁ميل ك ▁جماعة ▁ترابية ▁قروية ▁كاينة ▁في ▁إقليم ▁اشتوكة … (+16 more)` | 26 | | |
| | 64k | `▁آيت ▁ميلك ▁جماعة ▁ترابية ▁قروية ▁كاينة ▁في ▁إقليم ▁اشتوكة ▁آيت … (+15 more)` | 25 | | |
| **Sample 3:** `خديجة بنت علي بن أبي طالب، هي بنت علي بن أبي طالب. مصادر د نسا` | |
| | Vocab | Tokens | Count | | |
| |-------|--------|-------| | |
| | 8k | `▁خديجة ▁بنت ▁علي ▁بن ▁أبي ▁طالب ، ▁هي ▁بنت ▁علي … (+7 more)` | 17 | | |
| | 16k | `▁خديجة ▁بنت ▁علي ▁بن ▁أبي ▁طالب ، ▁هي ▁بنت ▁علي … (+7 more)` | 17 | | |
| | 32k | `▁خديجة ▁بنت ▁علي ▁بن ▁أبي ▁طالب ، ▁هي ▁بنت ▁علي … (+7 more)` | 17 | | |
| | 64k | `▁خديجة ▁بنت ▁علي ▁بن ▁أبي ▁طالب ، ▁هي ▁بنت ▁علي … (+7 more)` | 17 | | |
| </details> | |
| ### Load Word Embeddings | |
| ```python | |
| from gensim.models import KeyedVectors | |
| # Aligned embeddings (cross-lingual, mapped to English vector space) | |
| wv = KeyedVectors.load("ary_embeddings_128d_aligned.kv") | |
| similar = wv.most_similar("word", topn=5) | |
| for word, score in similar: | |
| print(f" {word}: {score:.3f}") | |
| ``` | |
| ### Load N-gram Model | |
| ```python | |
| import pyarrow.parquet as pq | |
| df = pq.read_table("ary_3gram_word.parquet").to_pandas() | |
| print(df.head()) | |
| ``` | |
| ## Models Overview | |
|  | |
| | Category | Assets | | |
| |----------|--------| | |
| | Tokenizers | BPE at 8k, 16k, 32k, 64k vocab sizes | | |
| | N-gram models | 2 / 3 / 4 / 5-gram (word & subword) | | |
| | Markov chains | Context 1–5 (word & subword) | | |
| | Embeddings | 32d, 64d, 128d — mono & aligned | | |
| | Vocabulary | Full frequency list + Zipf analysis | | |
| | Statistics | Corpus & model statistics JSON | | |
| ## Metrics Summary | |
| | Component | Model | Key Metric | Value | | |
| |-----------|-------|------------|-------| | |
| | Tokenizer | 8k BPE | Compression | 3.48x | | |
| | Tokenizer | 16k BPE | Compression | 3.76x | | |
| | Tokenizer | 32k BPE | Compression | 3.98x | | |
| | Tokenizer | 64k BPE | Compression | 4.17x 🏆 | | |
| | N-gram | 2-gram (subword) | Perplexity | 428 🏆 | | |
| | N-gram | 2-gram (word) | Perplexity | 7,415 | | |
| | N-gram | 3-gram (subword) | Perplexity | 3,823 | | |
| | N-gram | 3-gram (word) | Perplexity | 5,775 | | |
| | N-gram | 4-gram (subword) | Perplexity | 20,320 | | |
| | N-gram | 4-gram (word) | Perplexity | 8,149 | | |
| | N-gram | 5-gram (subword) | Perplexity | 63,356 | | |
| | N-gram | 5-gram (word) | Perplexity | 7,702 | | |
| | Markov | ctx-1 (subword) | Predictability | 0.0% | | |
| | Markov | ctx-1 (word) | Predictability | 14.2% | | |
| | Markov | ctx-2 (subword) | Predictability | 18.4% | | |
| | Markov | ctx-2 (word) | Predictability | 77.3% | | |
| | Markov | ctx-3 (subword) | Predictability | 19.7% | | |
| | Markov | ctx-3 (word) | Predictability | 93.8% | | |
| | Markov | ctx-4 (subword) | Predictability | 33.7% | | |
| | Markov | ctx-4 (word) | Predictability | 97.9% 🏆 | | |
| | Vocabulary | full | Size | 79,667 | | |
| | Vocabulary | full | Zipf R² | 0.9989 | | |
| | Embeddings | mono_32d | Isotropy | 0.8215 🏆 | | |
| | Embeddings | mono_64d | Isotropy | 0.8006 | | |
| | Embeddings | mono_128d | Isotropy | 0.6555 | | |
| | Embeddings | aligned_32d | Isotropy | 0.8215 | | |
| | Embeddings | aligned_64d | Isotropy | 0.8006 | | |
| | Embeddings | aligned_128d | Isotropy | 0.6555 | | |
| | Alignment | aligned_32d | R@1 / R@5 / R@10 | 0.8% / 5.8% / 10.8% | | |
| | Alignment | aligned_64d | R@1 / R@5 / R@10 | 3.8% / 10.0% / 20.0% | | |
| | Alignment | aligned_128d | R@1 / R@5 / R@10 | 4.4% / 15.6% / 24.2% 🏆 | | |
| 📊 **[Full ablation study, per-model breakdowns, and interpretation guide →](RESEARCH_REPORT.md)** | |
| --- | |
| ## About | |
| Trained on [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) — monthly snapshots of 300+ Wikipedia languages. | |
| A project by **[Wikilangs](https://wikilangs.org)** · Maintainer: [Omar Kamali](https://omarkamali.com) · [Omneity Labs](https://omneitylabs.com) | |
| ### Citation | |
| ```bibtex | |
| @misc{wikilangs2025, | |
| author = {Kamali, Omar}, | |
| title = {Wikilangs: Open NLP Models for Wikipedia Languages}, | |
| year = {2025}, | |
| doi = {10.5281/zenodo.18073153}, | |
| publisher = {Zenodo}, | |
| url = {https://huggingface.co/wikilangs}, | |
| institution = {Omneity Labs} | |
| } | |
| ``` | |
| ### Links | |
| - 🌐 [wikilangs.org](https://wikilangs.org) | |
| - 🌍 [Language page](https://wikilangs.org/languages/ary/) | |
| - 🎮 [Playground](https://wikilangs.org/playground/?lang=ary) | |
| - 🤗 [HuggingFace models](https://huggingface.co/wikilangs) | |
| - 📊 [wikipedia-monthly dataset](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) | |
| - 👤 [Omar Kamali](https://huggingface.co/omarkamali) | |
| - 🤝 Sponsor: [Featherless AI](https://featherless.ai) | |
| **License:** MIT — free for academic and commercial use. | |
| --- | |
| *Generated by Wikilangs Pipeline · 2026-03-02 12:03:27* | |