| --- |
| language: ps |
| language_name: Pashto |
| language_family: iranian_eastern |
| 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-iranian_eastern |
| 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: 3.755 |
| - name: best_isotropy |
| type: isotropy |
| value: 0.8418 |
| - name: vocabulary_size |
| type: vocab |
| value: 0 |
| generated: 2026-01-10 |
| --- |
| |
| # Pashto - Wikilangs Models |
| ## Comprehensive Research Report & Full Ablation Study |
|
|
| This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Pashto** Wikipedia data. |
| We analyze tokenizers, n-gram models, Markov chains, vocabulary statistics, and word embeddings. |
|
|
| ## 📋 Repository Contents |
|
|
| ### Models & Assets |
|
|
| - Tokenizers (8k, 16k, 32k, 64k) |
| - N-gram models (2, 3, 4, 5-gram) |
| - Markov chains (context of 1, 2, 3, 4 and 5) |
| - Subword N-gram and Markov chains |
| - Embeddings in various sizes and dimensions (aligned and unaligned) |
| - Language Vocabulary |
| - Language Statistics |
|
|
|  |
|
|
| ### Analysis and Evaluation |
|
|
| - [1. Tokenizer Evaluation](#1-tokenizer-evaluation) |
| - [2. N-gram Model Evaluation](#2-n-gram-model-evaluation) |
| - [3. Markov Chain Evaluation](#3-markov-chain-evaluation) |
| - [4. Vocabulary Analysis](#4-vocabulary-analysis) |
| - [5. Word Embeddings Evaluation](#5-word-embeddings-evaluation) |
| - [6. Morphological Analysis (Experimental)](#6--morphological-analysis-experimental) |
| - [7. Summary & Recommendations](#7-summary--recommendations) |
| - [Metrics Glossary](#appendix-metrics-glossary--interpretation-guide) |
| - [Visualizations Index](#visualizations-index) |
|
|
| --- |
| ## 1. Tokenizer Evaluation |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
| ### Results |
|
|
| | Vocab Size | Compression | Avg Token Len | UNK Rate | Total Tokens | |
| |------------|-------------|---------------|----------|--------------| |
| | **8k** | 3.070x | 3.07 | 0.0575% | 1,690,830 | |
| | **16k** | 3.354x | 3.35 | 0.0628% | 1,547,668 | |
| | **32k** | 3.584x | 3.58 | 0.0671% | 1,448,273 | |
| | **64k** | 3.755x 🏆 | 3.76 | 0.0703% | 1,382,248 | |
|
|
| ### Tokenization Examples |
|
|
| Below are sample sentences tokenized with each vocabulary size: |
|
|
| **Sample 1:** `ډیلي د ختیځ تیمور هیواد پلازمینه یاد ښار د ختیځ تیمور اصلی بندر او تجارتی مرکز ګ...` |
|
|
| | Vocab | Tokens | Count | |
| |-------|--------|-------| |
| | 8k | `▁ډیلي ▁د ▁ختیځ ▁تیمور ▁هیواد ▁پلازمینه ▁یاد ▁ښار ▁د ▁ختیځ ... (+27 more)` | 37 | |
| | 16k | `▁ډیلي ▁د ▁ختیځ ▁تیمور ▁هیواد ▁پلازمینه ▁یاد ▁ښار ▁د ▁ختیځ ... (+25 more)` | 35 | |
| | 32k | `▁ډیلي ▁د ▁ختیځ ▁تیمور ▁هیواد ▁پلازمینه ▁یاد ▁ښار ▁د ▁ختیځ ... (+25 more)` | 35 | |
| | 64k | `▁ډیلي ▁د ▁ختیځ ▁تیمور ▁هیواد ▁پلازمینه ▁یاد ▁ښار ▁د ▁ختیځ ... (+24 more)` | 34 | |
|
|
| **Sample 2:** `د اشکامش ولسوالۍ د تخار ولايت یوه ولسوالۍ ده. په دغې ولسوالۍ کې د مېشتو خلکو شمې...` |
|
|
| | Vocab | Tokens | Count | |
| |-------|--------|-------| |
| | 8k | `▁د ▁اش کام ش ▁ولسوالۍ ▁د ▁تخار ▁ولايت ▁یوه ▁ولسوالۍ ... (+21 more)` | 31 | |
| | 16k | `▁د ▁اش کام ش ▁ولسوالۍ ▁د ▁تخار ▁ولايت ▁یوه ▁ولسوالۍ ... (+21 more)` | 31 | |
| | 32k | `▁د ▁اش کام ش ▁ولسوالۍ ▁د ▁تخار ▁ولايت ▁یوه ▁ولسوالۍ ... (+21 more)` | 31 | |
| | 64k | `▁د ▁اش کام ش ▁ولسوالۍ ▁د ▁تخار ▁ولايت ▁یوه ▁ولسوالۍ ... (+20 more)` | 30 | |
|
|
| **Sample 3:** `اورګان آیالات (آورګان) یاهم (اوریګون) په انګلیسي Oregon) د امریکا متحده آیالاتون...` |
|
|
| | Vocab | Tokens | Count | |
| |-------|--------|-------| |
| | 8k | `▁اورګ ان ▁آیالات ▁( آ ور ګان ) ▁یاهم ▁( ... (+20 more)` | 30 | |
| | 16k | `▁اورګ ان ▁آیالات ▁( آ ور ګان ) ▁یاهم ▁( ... (+19 more)` | 29 | |
| | 32k | `▁اورګ ان ▁آیالات ▁( آ ور ګان ) ▁یاهم ▁( ... (+19 more)` | 29 | |
| | 64k | `▁اورګان ▁آیالات ▁( آ ورګان ) ▁یاهم ▁( ا وری ... (+16 more)` | 26 | |
|
|
|
|
| ### Key Findings |
|
|
| - **Best Compression:** 64k achieves 3.755x compression |
| - **Lowest UNK Rate:** 8k with 0.0575% unknown tokens |
| - **Trade-off:** Larger vocabularies improve compression but increase model size |
| - **Recommendation:** 32k vocabulary provides optimal balance for production use |
|
|
| --- |
| ## 2. N-gram Model Evaluation |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
| ### Results |
|
|
| | N-gram | Variant | Perplexity | Entropy | Unique N-grams | Top-100 Coverage | Top-1000 Coverage | |
| |--------|---------|------------|---------|----------------|------------------|-------------------| |
| | **2-gram** | Word | 45,674 | 15.48 | 297,254 | 12.5% | 28.9% | |
| | **2-gram** | Subword | 413 🏆 | 8.69 | 15,507 | 59.5% | 95.4% | |
| | **3-gram** | Word | 171,855 | 17.39 | 538,733 | 5.2% | 14.6% | |
| | **3-gram** | Subword | 3,798 | 11.89 | 114,771 | 25.0% | 61.5% | |
| | **4-gram** | Word | 476,041 | 18.86 | 940,357 | 2.8% | 8.3% | |
| | **4-gram** | Subword | 23,206 | 14.50 | 601,330 | 12.4% | 33.8% | |
| | **5-gram** | Word | 400,777 | 18.61 | 620,569 | 2.6% | 7.4% | |
| | **5-gram** | Subword | 97,008 | 16.57 | 1,632,083 | 6.4% | 20.6% | |
|
|
| ### Top 5 N-grams by Size |
|
|
| **2-grams (Word):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `کې د` | 101,609 | |
| | 2 | `چې د` | 81,225 | |
| | 3 | `او د` | 75,622 | |
| | 4 | `چې په` | 35,921 | |
| | 5 | `په توګه` | 27,634 | |
|
|
| **3-grams (Word):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `په کال کې` | 16,971 | |
| | 2 | `کال کې د` | 10,963 | |
| | 3 | `د کال د` | 7,888 | |
| | 4 | `په زکال کې` | 6,540 | |
| | 5 | `حال کې چې` | 6,283 | |
|
|
| **4-grams (Word):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `په کال کې د` | 6,807 | |
| | 2 | `په داسې حال کې` | 5,964 | |
| | 3 | `په ز کال کې` | 5,740 | |
| | 4 | `داسې حال کې چې` | 5,705 | |
| | 5 | `په زکال کې د` | 2,929 | |
|
|
| **5-grams (Word):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `په داسې حال کې چې` | 5,659 | |
| | 2 | `په ز کال کې د` | 2,507 | |
| | 3 | `داسې حال کې چې د` | 1,709 | |
| | 4 | `زکال څخه تر زکال پورې` | 656 | |
| | 5 | `له زکال څخه تر زکال` | 644 | |
|
|
| **2-grams (Subword):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `ه _` | 2,871,045 | |
| | 2 | `_ د` | 1,942,072 | |
| | 3 | `ې _` | 1,592,102 | |
| | 4 | `و _` | 1,523,631 | |
| | 5 | `د _` | 1,482,416 | |
|
|
| **3-grams (Subword):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `_ د _` | 1,230,113 | |
| | 2 | `پ ه _` | 685,331 | |
| | 3 | `_ پ ه` | 666,884 | |
| | 4 | `_ ا و` | 512,538 | |
| | 5 | `ا و _` | 430,611 | |
|
|
| **4-grams (Subword):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `_ پ ه _` | 666,254 | |
| | 2 | `_ ا و _` | 419,517 | |
| | 3 | `_ ک ې _` | 323,812 | |
| | 4 | `ې _ د _` | 278,354 | |
| | 5 | `_ چ ې _` | 264,546 | |
|
|
| **5-grams (Subword):** |
|
|
| | Rank | N-gram | Count | |
| |------|--------|-------| |
| | 1 | `ې _ پ ه _` | 117,595 | |
| | 2 | `_ ک ې _ د` | 110,616 | |
| | 3 | `و _ پ ه _` | 102,895 | |
| | 4 | `ک ې _ د _` | 100,894 | |
| | 5 | `_ چ ې _ د` | 100,640 | |
|
|
|
|
| ### Key Findings |
|
|
| - **Best Perplexity:** 2-gram (subword) with 413 |
| - **Entropy Trend:** Decreases with larger n-grams (more predictable) |
| - **Coverage:** Top-1000 patterns cover ~21% of corpus |
| - **Recommendation:** 4-gram or 5-gram for best predictive performance |
|
|
| --- |
| ## 3. Markov Chain Evaluation |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
| ### Results |
|
|
| | Context | Variant | Avg Entropy | Perplexity | Branching Factor | Unique Contexts | Predictability | |
| |---------|---------|-------------|------------|------------------|-----------------|----------------| |
| | **1** | Word | 0.8526 | 1.806 | 8.06 | 503,287 | 14.7% | |
| | **1** | Subword | 1.0126 | 2.018 | 8.82 | 4,882 | 0.0% | |
| | **2** | Word | 0.3595 | 1.283 | 2.20 | 4,051,006 | 64.1% | |
| | **2** | Subword | 0.8406 | 1.791 | 5.62 | 43,065 | 15.9% | |
| | **3** | Word | 0.1526 | 1.112 | 1.34 | 8,883,549 | 84.7% | |
| | **3** | Subword | 0.7785 | 1.715 | 4.36 | 241,991 | 22.2% | |
| | **4** | Word | 0.0613 🏆 | 1.043 | 1.11 | 11,890,030 | 93.9% | |
| | **4** | Subword | 0.6609 | 1.581 | 3.11 | 1,054,058 | 33.9% | |
|
|
| ### Generated Text Samples (Word-based) |
|
|
| Below are text samples generated from each word-based Markov chain model: |
|
|
| **Context Size 1:** |
|
|
| 1. `د واقعیت کې په اصل د ناردرن پوهنتون کې په سیمه کي د سوریې د محاصرې` |
| 2. `په او په بڼه پراخه ډله پالو جنگیالیو ویاړونه یې له طبیعي قانون هغه نور یې` |
| 3. `او رازمحمد محمدی له زياتو اسنتياوو ځه زه يم چې له بدلون په خاطر رامنځته او` |
|
|
| **Context Size 2:** |
|
|
| 1. `کې د ولسمشرۍ په ماڼۍ کي پيل کيژي اوداسد په مياشت كې كله پيسي زياتيږي او په` |
| 2. `چې د سلطنتي کورنۍ تر نظارت لاندي زده کړي هغه په کاملو پاڼو کې لټوی او خپل` |
| 3. `او د جاپان ریل پټلۍ ورغوي نور انجینري فلزي محصولات ۲۱ ۱ صف ۲۱ ۲ ميليونه ټنونو` |
|
|
| **Context Size 3:** |
|
|
| 1. `په کال کې په همدې کنفرانس کې تقریبآ ۳۵۰ملی او نړيوالو چینلونو او رسنیو له خوا د ۳۰` |
| 2. `کال کې د دوهم وېلهليم لخوا د اوټو ون بسمارک د حکومت مشر او د چين له حکومت` |
| 3. `د کال د جولای په ۲۸ یې د پيلوټۍ شمېره تصدیقنامه او د کال تر جنورۍ پورې یې` |
|
|
| **Context Size 4:** |
|
|
| 1. `په کال کې د bienvenue à monseigneur le duc d anjou په نوم د ماشومانو لپاره په کابل کې` |
| 2. `په داسې حال کې چې پلازمېنه يې د سيوډاډ ډي پورټو ريکو شتمن بندري ښار نومېږي بالاخره سوداګرو او` |
| 3. `په ز کال کې فواره تر څنډو fountain overflows دا رښتينې شپه this real night چې له مړينې څخه` |
|
|
|
|
| ### Generated Text Samples (Subword-based) |
|
|
| Below are text samples generated from each subword-based Markov chain model: |
|
|
| **Context Size 1:** |
|
|
| 1. `_«_ر_(_زړيخیاړیق` |
| 2. `ور_خه_څخه_نګو_او` |
| 3. `ارسیېرد_کاسې_ځام` |
|
|
| **Context Size 2:** |
|
|
| 1. `ه_هم_وکرښت_ده_يا_` |
| 2. `_د_بری_ژونکي_او_ا` |
| 3. `ې_ځړانسولى_دو_له_` |
|
|
| **Context Size 3:** |
|
|
| 1. `_د_معبدالقرنيو_سره` |
| 2. `په_طبیعي_سره_تعریف` |
| 3. `_په_هغې_د_انسان_کړ` |
|
|
| **Context Size 4:** |
|
|
| 1. `_په_توګه_يې_ادب_په_` |
| 2. `_او_21_cfr_pass_emp` |
| 3. `_کې_دا_بڼو_او_اړخون` |
|
|
|
|
| ### Key Findings |
|
|
| - **Best Predictability:** Context-4 (word) with 93.9% predictability |
| - **Branching Factor:** Decreases with context size (more deterministic) |
| - **Memory Trade-off:** Larger contexts require more storage (1,054,058 contexts) |
| - **Recommendation:** Context-3 or Context-4 for text generation |
|
|
| --- |
| ## 4. Vocabulary Analysis |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
| ### Statistics |
|
|
| | Metric | Value | |
| |--------|-------| |
| | Vocabulary Size | 217,546 | |
| | Total Tokens | 14,149,518 | |
| | Mean Frequency | 65.04 | |
| | Median Frequency | 4 | |
| | Frequency Std Dev | 3465.58 | |
|
|
| ### Most Common Words |
|
|
| | Rank | Word | Frequency | |
| |------|------|-----------| |
| | 1 | د | 1,254,743 | |
| | 2 | په | 675,956 | |
| | 3 | او | 421,489 | |
| | 4 | کې | 342,021 | |
| | 5 | چې | 274,692 | |
| | 6 | له | 235,307 | |
| | 7 | ته | 126,758 | |
| | 8 | سره | 101,317 | |
| | 9 | هغه | 92,015 | |
| | 10 | څخه | 87,815 | |
|
|
| ### Least Common Words (from vocabulary) |
|
|
| | Rank | Word | Frequency | |
| |------|------|-----------| |
| | 1 | زېډ | 2 | |
| | 2 | تیموری | 2 | |
| | 3 | الأحمر | 2 | |
| | 4 | البشتون | 2 | |
| | 5 | بیټسمینانو | 2 | |
| | 6 | فیبوناسي | 2 | |
| | 7 | لسیال | 2 | |
| | 8 | بوګیا | 2 | |
| | 9 | abridgement | 2 | |
| | 10 | needhams | 2 | |
|
|
| ### Zipf's Law Analysis |
|
|
| | Metric | Value | |
| |--------|-------| |
| | Zipf Coefficient | 1.0558 | |
| | R² (Goodness of Fit) | 0.993922 | |
| | Adherence Quality | **excellent** | |
|
|
| ### Coverage Analysis |
|
|
| | Top N Words | Coverage | |
| |-------------|----------| |
| | Top 100 | 43.4% | |
| | Top 1,000 | 64.5% | |
| | Top 5,000 | 80.5% | |
| | Top 10,000 | 86.3% | |
|
|
| ### Key Findings |
|
|
| - **Zipf Compliance:** R²=0.9939 indicates excellent adherence to Zipf's law |
| - **High Frequency Dominance:** Top 100 words cover 43.4% of corpus |
| - **Long Tail:** 207,546 words needed for remaining 13.7% coverage |
|
|
| --- |
| ## 5. Word Embeddings Evaluation |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
|  |
|
|
|
|
| ### 5.1 Cross-Lingual Alignment |
|
|
|  |
|
|
|  |
|
|
|
|
| ### 5.2 Model Comparison |
|
|
| | Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 | |
| |-------|-----------|----------|------------------|---------------|----------------| |
| | **mono_32d** | 32 | 0.8418 | 0.3831 | N/A | N/A | |
| | **mono_64d** | 64 | 0.8348 | 0.3051 | N/A | N/A | |
| | **mono_128d** | 128 | 0.8087 | 0.2314 | N/A | N/A | |
| | **aligned_32d** | 32 | 0.8418 🏆 | 0.3891 | 0.0500 | 0.2360 | |
| | **aligned_64d** | 64 | 0.8348 | 0.3128 | 0.1100 | 0.3720 | |
| | **aligned_128d** | 128 | 0.8087 | 0.2225 | 0.1160 | 0.3960 | |
|
|
| ### Key Findings |
|
|
| - **Best Isotropy:** aligned_32d with 0.8418 (more uniform distribution) |
| - **Semantic Density:** Average pairwise similarity of 0.3073. Lower values indicate better semantic separation. |
| - **Alignment Quality:** Aligned models achieve up to 11.6% R@1 in cross-lingual retrieval. |
| - **Recommendation:** 128d aligned for best cross-lingual performance |
| |
| --- |
| ## 6. Morphological Analysis (Experimental) |
| |
| This section presents an automated morphological analysis derived from the statistical divergence between word-level and subword-level models. By analyzing where subword predictability spikes and where word-level coverage fails, we can infer linguistic structures without supervised data. |
| |
| ### 6.1 Productivity & Complexity |
| |
| | Metric | Value | Interpretation | Recommendation | |
| |--------|-------|----------------|----------------| |
| | Productivity Index | **5.000** | High morphological productivity | Reliable analysis | |
| | Idiomaticity Gap | **-0.638** | Low formulaic content | - | |
| |
| ### 6.2 Affix Inventory (Productive Units) |
| |
| These are the most productive prefixes and suffixes identified by sampling the vocabulary for global substitutability patterns. A unit is considered an affix if stripping it leaves a valid stem that appears in other contexts. |
| |
| #### Productive Prefixes |
| | Prefix | Examples | |
| |--------|----------| |
| | `-ا` | اقاخان, امویانو, الکینو | |
| | `-د` | داراز, دانګوروشراب, دسروالجيانو | |
| | `-م` | مالټ, منځنۍ, مگزين | |
| | `-او` | اوباسو, اوتوبيوګرافي, اورونوکنترول | |
| | `-ال` | الکینو, الشعرا, الګوري | |
| | `-و` | وايى, وطنونه, وبسایټ | |
| | `-ب` | بوډا, بيلولو, برېـښي | |
| | `-س` | سوخوی, سیکھ, سرای | |
| |
| #### Productive Suffixes |
| | Suffix | Examples | |
| |--------|----------| |
| | `-و` | امویانو, ليدو, الکینو | |
| | `-ه` | رواده, خايسته, وطنونه | |
| | `-ي` | پيداکیږي, شېرعلي, اوتوبيوګرافي | |
| | `-نو` | امویانو, الکینو, ګابېنونو | |
| | `-ن` | اقاخان, هېډن, چمپین | |
| | `-s` | eats, specimens, dinosaurs | |
| | `-نه` | وطنونه, ختنه, ټيپونه | |
| | `-ې` | پياوړې, سوړې, کرايې | |
| |
| ### 6.3 Bound Stems (Lexical Roots) |
| |
| Bound stems are high-frequency subword units that are semantically cohesive but rarely appear as standalone words. These often correspond to the 'core' of a word that requires inflection or derivation to be valid. |
| |
| | Stem | Cohesion | Substitutability | Examples | |
| |------|----------|------------------|----------| |
| | `tion` | 3.19x | 58 contexts | aktion, option, cation | |
| | `وونک` | 1.73x | 355 contexts | کوونک, وونکی, وونکو | |
| | `دونک` | 1.76x | 186 contexts | دونکی, یدونکی, ندونکي | |
| | `وادو` | 2.00x | 64 contexts | موادو, وادوڅ, دموادو | |
| | `رسره` | 2.39x | 29 contexts | ترسره, درسره, ورسره | |
| | `تاری` | 2.18x | 39 contexts | تاریخ, تاریم, تاریځ | |
| | `ځانګ` | 2.13x | 39 contexts | ځانګړ, ځانګو, ځانګې | |
| | `ادون` | 1.67x | 100 contexts | مادون, يادون, یادون | |
| | `وړان` | 1.80x | 63 contexts | وړانی, وړانګ, وړاند | |
| | `ولای` | 1.67x | 87 contexts | كولای, دولای, کولای | |
| | `غانس` | 2.97x | 11 contexts | افغانست, فغانستان, افغانستا | |
| | `وموړ` | 2.18x | 28 contexts | وموړې, نوموړ, نوموړﺉ | |
| |
| ### 6.4 Affix Compatibility (Co-occurrence) |
| |
| This table shows which prefixes and suffixes most frequently co-occur on the same stems, revealing the 'stacking' rules of the language's morphology. |
| |
| | Prefix | Suffix | Frequency | Examples | |
| |--------|--------|-----------|----------| |
| | `-ا` | `-ي` | 94 words | امازوني, اوپاتي | |
| | `-ا` | `-ن` | 60 words | الکافرون, الجنون | |
| | `-م` | `-و` | 56 words | مرخيړيو, ملېشو | |
| | `-ا` | `-ه` | 56 words | اخلاقپوه, ایونونه | |
| | `-ا` | `-و` | 55 words | انجيلو, اليساندرو | |
| | `-د` | `-و` | 46 words | دکوندو, دیلانو | |
| | `-د` | `-ه` | 44 words | دډيروخلکولپاره, درنه | |
| | `-م` | `-ه` | 42 words | ماړه, ماډله | |
| | `-ک` | `-و` | 37 words | کرهنیزو, کټګوریو | |
| | `-و` | `-ه` | 35 words | واه, وځلوله | |
| |
| ### 6.5 Recursive Morpheme Segmentation |
| |
| Using **Recursive Hierarchical Substitutability**, we decompose complex words into their constituent morphemes. This approach handles nested affixes (e.g., `prefix-prefix-root-suffix`). |
| |
| | Word | Suggested Split | Confidence | Stem | |
| |------|-----------------|------------|------| |
| | ماشومانوته | **`ماشومانو-ت-ه`** | 7.5 | `ت` | |
| | دماشينونو | **`دماشي-نو-نو`** | 7.5 | `نو` | |
| | سلوبونوکي | **`سلوبو-نو-کي`** | 7.5 | `نو` | |
| | دالکینونو | **`دالکی-نو-نو`** | 7.5 | `نو` | |
| | ميلیونونه | **`ميلیو-نو-نه`** | 7.5 | `نو` | |
| | تصمیمنیوونې | **`تصمیمنیو-و-نې`** | 7.5 | `و` | |
| | مسلمانانود | **`مسلمانا-نو-د`** | 7.5 | `نو` | |
| | فزیکپوهنه | **`فزیکپو-ه-نه`** | 7.5 | `ه` | |
| | بیتکوینونه | **`بیتکوی-نو-نه`** | 7.5 | `نو` | |
| | سازمونونه | **`سازمو-نو-نه`** | 7.5 | `نو` | |
| | مېلمستونونه | **`مېلمستو-نو-نه`** | 7.5 | `نو` | |
| | مالکیتونو | **`مالکیت-و-نو`** | 7.5 | `و` | |
| | بریتانیوی | **`بریتانی-و-ی`** | 7.5 | `و` | |
| | نورکارونه | **`ن-ور-کارونه`** | 6.0 | `کارونه` | |
| | الوتونکيو | **`ال-وتونکي-و`** | 6.0 | `وتونکي` | |
| |
| ### 6.6 Linguistic Interpretation |
| |
| > **Automated Insight:** |
| The language Pashto shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding. |
| |
| --- |
| ## 7. Summary & Recommendations |
| |
|  |
| |
| ### Production Recommendations |
| |
| | Component | Recommended | Rationale | |
| |-----------|-------------|-----------| |
| | Tokenizer | **64k BPE** | Best compression (3.76x) | |
| | N-gram | **2-gram** | Lowest perplexity (413) | |
| | Markov | **Context-4** | Highest predictability (93.9%) | |
| | Embeddings | **100d** | Balanced semantic capture and isotropy | |
| |
| |
| --- |
| ## Appendix: Metrics Glossary & Interpretation Guide |
| |
| This section provides definitions, intuitions, and guidance for interpreting the metrics used throughout this report. |
| |
| ### Tokenizer Metrics |
| |
| **Compression Ratio** |
| > *Definition:* The ratio of characters to tokens (chars/token). Measures how efficiently the tokenizer represents text. |
| > |
| > *Intuition:* Higher compression means fewer tokens needed to represent the same text, reducing sequence lengths for downstream models. A 3x compression means ~3 characters per token on average. |
| > |
| > *What to seek:* Higher is generally better for efficiency, but extremely high compression may indicate overly aggressive merging that loses morphological information. |
| |
| **Average Token Length (Fertility)** |
| > *Definition:* Mean number of characters per token produced by the tokenizer. |
| > |
| > *Intuition:* Reflects the granularity of tokenization. Longer tokens capture more context but may struggle with rare words; shorter tokens are more flexible but increase sequence length. |
| > |
| > *What to seek:* Balance between 2-5 characters for most languages. Arabic/morphologically-rich languages may benefit from slightly longer tokens. |
| |
| **Unknown Token Rate (OOV Rate)** |
| > *Definition:* Percentage of tokens that map to the unknown/UNK token, indicating words the tokenizer cannot represent. |
| > |
| > *Intuition:* Lower OOV means better vocabulary coverage. High OOV indicates the tokenizer encounters many unseen character sequences. |
| > |
| > *What to seek:* Below 1% is excellent; below 5% is acceptable. BPE tokenizers typically achieve very low OOV due to subword fallback. |
| |
| ### N-gram Model Metrics |
| |
| **Perplexity** |
| > *Definition:* Measures how "surprised" the model is by test data. Mathematically: 2^(cross-entropy). Lower values indicate better prediction. |
| > |
| > *Intuition:* If perplexity is 100, the model is as uncertain as if choosing uniformly among 100 options at each step. A perplexity of 10 means effectively choosing among 10 equally likely options. |
| > |
| > *What to seek:* Lower is better. Perplexity decreases with larger n-grams (more context). Values vary widely by language and corpus size. |
| |
| **Entropy** |
| > *Definition:* Average information content (in bits) needed to encode the next token given the context. Related to perplexity: perplexity = 2^entropy. |
| > |
| > *Intuition:* High entropy means high uncertainty/randomness; low entropy means predictable patterns. Natural language typically has entropy between 1-4 bits per character. |
| > |
| > *What to seek:* Lower entropy indicates more predictable text patterns. Entropy should decrease as n-gram size increases. |
| |
| **Coverage (Top-K)** |
| > *Definition:* Percentage of corpus occurrences explained by the top K most frequent n-grams. |
| > |
| > *Intuition:* High coverage with few patterns indicates repetitive/formulaic text; low coverage suggests diverse vocabulary usage. |
| > |
| > *What to seek:* Depends on use case. For language modeling, moderate coverage (40-60% with top-1000) is typical for natural text. |
| |
| ### Markov Chain Metrics |
| |
| **Average Entropy** |
| > *Definition:* Mean entropy across all contexts, measuring average uncertainty in next-word prediction. |
| > |
| > *Intuition:* Lower entropy means the model is more confident about what comes next. Context-1 has high entropy (many possible next words); Context-4 has low entropy (few likely continuations). |
| > |
| > *What to seek:* Decreasing entropy with larger context sizes. Very low entropy (<0.1) indicates highly deterministic transitions. |
| |
| **Branching Factor** |
| > *Definition:* Average number of unique next tokens observed for each context. |
| > |
| > *Intuition:* High branching = many possible continuations (flexible but uncertain); low branching = few options (predictable but potentially repetitive). |
| > |
| > *What to seek:* Branching factor should decrease with context size. Values near 1.0 indicate nearly deterministic chains. |
| |
| **Predictability** |
| > *Definition:* Derived metric: (1 - normalized_entropy) × 100%. Indicates how deterministic the model's predictions are. |
| > |
| > *Intuition:* 100% predictability means the next word is always certain; 0% means completely random. Real text falls between these extremes. |
| > |
| > *What to seek:* Higher predictability for text generation quality, but too high (>98%) may produce repetitive output. |
|
|
| ### Vocabulary & Zipf's Law Metrics |
|
|
| **Zipf's Coefficient** |
| > *Definition:* The slope of the log-log plot of word frequency vs. rank. Zipf's law predicts this should be approximately -1. |
| > |
| > *Intuition:* A coefficient near -1 indicates the corpus follows natural language patterns where a few words are very common and most words are rare. |
| > |
| > *What to seek:* Values between -0.8 and -1.2 indicate healthy natural language distribution. Deviations may suggest domain-specific or artificial text. |
|
|
| **R² (Coefficient of Determination)** |
| > *Definition:* Measures how well the linear fit explains the frequency-rank relationship. Ranges from 0 to 1. |
| > |
| > *Intuition:* R² near 1.0 means the data closely follows Zipf's law; lower values indicate deviation from expected word frequency patterns. |
| > |
| > *What to seek:* R² > 0.95 is excellent; > 0.99 indicates near-perfect Zipf adherence typical of large natural corpora. |
|
|
| **Vocabulary Coverage** |
| > *Definition:* Cumulative percentage of corpus tokens accounted for by the top N words. |
| > |
| > *Intuition:* Shows how concentrated word usage is. If top-100 words cover 50% of text, the corpus relies heavily on common words. |
| > |
| > *What to seek:* Top-100 covering 30-50% is typical. Higher coverage indicates more repetitive text; lower suggests richer vocabulary. |
|
|
| ### Word Embedding Metrics |
|
|
| **Isotropy** |
| > *Definition:* Measures how uniformly distributed vectors are in the embedding space. Computed as the ratio of minimum to maximum singular values. |
| > |
| > *Intuition:* High isotropy (near 1.0) means vectors spread evenly in all directions; low isotropy means vectors cluster in certain directions, reducing expressiveness. |
| > |
| > *What to seek:* Higher isotropy generally indicates better-quality embeddings. Values > 0.1 are reasonable; > 0.3 is good. Lower-dimensional embeddings tend to have higher isotropy. |
|
|
| **Average Norm** |
| > *Definition:* Mean magnitude (L2 norm) of word vectors in the embedding space. |
| > |
| > *Intuition:* Indicates the typical "length" of vectors. Consistent norms suggest stable training; high variance may indicate some words are undertrained. |
| > |
| > *What to seek:* Relatively consistent norms across models. The absolute value matters less than consistency (low std deviation). |
|
|
| **Cosine Similarity** |
| > *Definition:* Measures angular similarity between vectors, ranging from -1 (opposite) to 1 (identical direction). |
| > |
| > *Intuition:* Words with similar meanings should have high cosine similarity. This is the standard metric for semantic relatedness in embeddings. |
| > |
| > *What to seek:* Semantically related words should score > 0.5; unrelated words should be near 0. Synonyms often score > 0.7. |
|
|
| **t-SNE Visualization** |
| > *Definition:* t-Distributed Stochastic Neighbor Embedding - a dimensionality reduction technique that preserves local structure for visualization. |
| > |
| > *Intuition:* Clusters in t-SNE plots indicate groups of semantically related words. Spread indicates vocabulary diversity; tight clusters suggest semantic coherence. |
| > |
| > *What to seek:* Meaningful clusters (e.g., numbers together, verbs together). Avoid over-interpreting distances - t-SNE preserves local, not global, structure. |
|
|
| ### General Interpretation Guidelines |
|
|
| 1. **Compare within model families:** Metrics are most meaningful when comparing models of the same type (e.g., 8k vs 64k tokenizer). |
| 2. **Consider trade-offs:** Better performance on one metric often comes at the cost of another (e.g., compression vs. OOV rate). |
| 3. **Context matters:** Optimal values depend on downstream tasks. Text generation may prioritize different metrics than classification. |
| 4. **Corpus influence:** All metrics are influenced by corpus characteristics. Wikipedia text differs from social media or literature. |
| 5. **Language-specific patterns:** Morphologically rich languages (like Arabic) may show different optimal ranges than analytic languages. |
|
|
|
|
| ### Visualizations Index |
|
|
| | Visualization | Description | |
| |---------------|-------------| |
| | Tokenizer Compression | Compression ratios by vocabulary size | |
| | Tokenizer Fertility | Average token length by vocabulary | |
| | Tokenizer OOV | Unknown token rates | |
| | Tokenizer Total Tokens | Total tokens by vocabulary | |
| | N-gram Perplexity | Perplexity by n-gram size | |
| | N-gram Entropy | Entropy by n-gram size | |
| | N-gram Coverage | Top pattern coverage | |
| | N-gram Unique | Unique n-gram counts | |
| | Markov Entropy | Entropy by context size | |
| | Markov Branching | Branching factor by context | |
| | Markov Contexts | Unique context counts | |
| | Zipf's Law | Frequency-rank distribution with fit | |
| | Vocab Frequency | Word frequency distribution | |
| | Top 20 Words | Most frequent words | |
| | Vocab Coverage | Cumulative coverage curve | |
| | Embedding Isotropy | Vector space uniformity | |
| | Embedding Norms | Vector magnitude distribution | |
| | Embedding Similarity | Word similarity heatmap | |
| | Nearest Neighbors | Similar words for key terms | |
| | t-SNE Words | 2D word embedding visualization | |
| | t-SNE Sentences | 2D sentence embedding visualization | |
| | Position Encoding | Encoding method comparison | |
| | Model Sizes | Storage requirements | |
| | Performance Dashboard | Comprehensive performance overview | |
|
|
| --- |
| ## About This Project |
|
|
| ### Data Source |
|
|
| Models trained on [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) - a monthly snapshot of Wikipedia articles across 300+ languages. |
|
|
| ### Project |
|
|
| A project by **[Wikilangs](https://wikilangs.org)** - Open-source NLP models for every Wikipedia language. |
|
|
| ### Maintainer |
|
|
| [Omar Kamali](https://omarkamali.com) - [Omneity Labs](https://omneitylabs.com) |
|
|
| ### Citation |
|
|
| If you use these models in your research, please cite: |
|
|
| ```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} |
| } |
| ``` |
|
|
| ### License |
|
|
| MIT License - Free for academic and commercial use. |
|
|
| ### Links |
|
|
| - 🌐 Website: [wikilangs.org](https://wikilangs.org) |
| - 🤗 Models: [huggingface.co/wikilangs](https://huggingface.co/wikilangs) |
| - 📊 Data: [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) |
| - 👤 Author: [Omar Kamali](https://huggingface.co/omarkamali) |
| - 🤝 Sponsor: [Featherless AI](https://featherless.ai) |
| --- |
| *Generated by Wikilangs Models Pipeline* |
|
|
| *Report Date: 2026-01-10 19:12:45* |
|
|