|
|
--- |
|
|
language: mg |
|
|
language_name: Malagasy |
|
|
language_family: austronesian_malagasy |
|
|
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-austronesian_malagasy |
|
|
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.455 |
|
|
- name: best_isotropy |
|
|
type: isotropy |
|
|
value: 0.8042 |
|
|
- name: vocabulary_size |
|
|
type: vocab |
|
|
value: 0 |
|
|
generated: 2026-01-10 |
|
|
--- |
|
|
|
|
|
# Malagasy - Wikilangs Models |
|
|
## Comprehensive Research Report & Full Ablation Study |
|
|
|
|
|
This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Malagasy** 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.717x | 3.72 | 1.0106% | 763,492 | |
|
|
| **16k** | 4.029x | 4.03 | 1.0955% | 704,362 | |
|
|
| **32k** | 4.266x | 4.27 | 1.1597% | 665,323 | |
|
|
| **64k** | 4.455x ๐ | 4.46 | 1.2113% | 637,017 | |
|
|
|
|
|
### Tokenization Examples |
|
|
|
|
|
Below are sample sentences tokenized with each vocabulary size: |
|
|
|
|
|
**Sample 1:** `I Taquaritinga dia kaominina ao , ao amin'i . Jeografia . Ny isam-ponina dia 56....` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โi โta qu arit inga โdia โkaominina โao โ, โao ... (+34 more)` | 44 | |
|
|
| 16k | `โi โta qu arit inga โdia โkaominina โao โ, โao ... (+34 more)` | 44 | |
|
|
| 32k | `โi โta qu arit inga โdia โkaominina โao โ, โao ... (+34 more)` | 44 | |
|
|
| 64k | `โi โtaqu aritinga โdia โkaominina โao โ, โao โamin ' ... (+32 more)` | 42 | |
|
|
|
|
|
**Sample 2:** `Zoltรกn Stieber dia mpilalao baolina kitra teraka ny 16 Oktobra tao Hongaria Jere...` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โz ol t รกn โst i eb er โdia โmpilalao ... (+16 more)` | 26 | |
|
|
| 16k | `โz olt รกn โst i eber โdia โmpilalao โbaolina โkitra ... (+13 more)` | 23 | |
|
|
| 32k | `โzoltรกn โst i eber โdia โmpilalao โbaolina โkitra โteraka โny ... (+11 more)` | 21 | |
|
|
| 64k | `โzoltรกn โsti eber โdia โmpilalao โbaolina โkitra โteraka โny โ ... (+10 more)` | 20 | |
|
|
|
|
|
**Sample 3:** `Rutger Backe dia mpilalao baolina kitra mizaka ny zom-pirenen'i Soeda teraka ny ...` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โr ut ger โba cke โdia โmpilalao โbaolina โkitra โmizaka ... (+18 more)` | 28 | |
|
|
| 16k | `โrut ger โba cke โdia โmpilalao โbaolina โkitra โmizaka โny ... (+17 more)` | 27 | |
|
|
| 32k | `โrut ger โba cke โdia โmpilalao โbaolina โkitra โmizaka โny ... (+17 more)` | 27 | |
|
|
| 64k | `โrut ger โba cke โdia โmpilalao โbaolina โkitra โmizaka โny ... (+17 more)` | 27 | |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Compression:** 64k achieves 4.455x compression |
|
|
- **Lowest UNK Rate:** 8k with 1.0106% 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 | 3,283 | 11.68 | 138,920 | 38.8% | 67.4% | |
|
|
| **2-gram** | Subword | 188 ๐ | 7.55 | 7,308 | 76.8% | 99.3% | |
|
|
| **3-gram** | Word | 6,811 | 12.73 | 327,650 | 31.9% | 62.3% | |
|
|
| **3-gram** | Subword | 1,135 | 10.15 | 56,079 | 43.5% | 83.4% | |
|
|
| **4-gram** | Word | 13,815 | 13.75 | 695,396 | 27.5% | 57.0% | |
|
|
| **4-gram** | Subword | 4,270 | 12.06 | 297,339 | 28.3% | 63.5% | |
|
|
| **5-gram** | Word | 15,415 | 13.91 | 666,811 | 25.9% | 55.7% | |
|
|
| **5-gram** | Subword | 10,797 | 13.40 | 801,473 | 21.0% | 52.1% | |
|
|
|
|
|
### Top 5 N-grams by Size |
|
|
|
|
|
**2-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `amin ny` | 363,322 | |
|
|
| 2 | `andro taona` | 205,790 | |
|
|
| 3 | `ao amin` | 204,188 | |
|
|
| 4 | `au au` | 199,079 | |
|
|
| 5 | `au andro` | 199,066 | |
|
|
|
|
|
**3-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `au andro taona` | 199,066 | |
|
|
| 2 | `au au andro` | 199,066 | |
|
|
| 3 | `ao amin ny` | 165,787 | |
|
|
| 4 | `tamin ny taona` | 75,724 | |
|
|
| 5 | `taona au au` | 52,606 | |
|
|
|
|
|
**4-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `au au andro taona` | 199,066 | |
|
|
| 2 | `au andro taona au` | 52,606 | |
|
|
| 3 | `andro taona au au` | 52,606 | |
|
|
| 4 | `taona au au andro` | 52,598 | |
|
|
| 5 | `amin ny faritr i` | 42,015 | |
|
|
|
|
|
**5-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `au andro taona au au` | 52,606 | |
|
|
| 2 | `au au andro taona au` | 52,606 | |
|
|
| 3 | `andro taona au au andro` | 52,598 | |
|
|
| 4 | `taona au au andro taona` | 52,598 | |
|
|
| 5 | `ao amin ny faritr i` | 41,743 | |
|
|
|
|
|
**2-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `y _` | 2,972,630 | |
|
|
| 2 | `a _` | 2,871,965 | |
|
|
| 3 | `a n` | 2,624,146 | |
|
|
| 4 | `_ a` | 2,225,943 | |
|
|
| 5 | `n y` | 2,058,703 | |
|
|
|
|
|
**3-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `n y _` | 1,991,132 | |
|
|
| 2 | `n a _` | 984,036 | |
|
|
| 3 | `_ n y` | 972,813 | |
|
|
| 4 | `m i n` | 698,997 | |
|
|
| 5 | `a n a` | 687,522 | |
|
|
|
|
|
**4-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `_ n y _` | 971,989 | |
|
|
| 2 | `a m i n` | 574,682 | |
|
|
| 3 | `m i n '` | 543,499 | |
|
|
| 4 | `' n y _` | 517,014 | |
|
|
| 5 | `n ' n y` | 516,967 | |
|
|
|
|
|
**5-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `a m i n '` | 543,348 | |
|
|
| 2 | `n ' n y _` | 516,918 | |
|
|
| 3 | `_ d i a _` | 465,119 | |
|
|
| 4 | `_ a m i n` | 438,819 | |
|
|
| 5 | `a u ) _ a` | 398,149 | |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Perplexity:** 2-gram (subword) with 188 |
|
|
- **Entropy Trend:** Decreases with larger n-grams (more predictable) |
|
|
- **Coverage:** Top-1000 patterns cover ~52% 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.6521 | 1.571 | 4.93 | 355,569 | 34.8% | |
|
|
| **1** | Subword | 0.6364 | 1.554 | 5.02 | 4,923 | 36.4% | |
|
|
| **2** | Word | 0.2834 | 1.217 | 1.88 | 1,748,434 | 71.7% | |
|
|
| **2** | Subword | 0.7914 | 1.731 | 4.56 | 24,686 | 20.9% | |
|
|
| **3** | Word | 0.1358 | 1.099 | 1.33 | 3,283,841 | 86.4% | |
|
|
| **3** | Subword | 0.8149 | 1.759 | 4.15 | 112,579 | 18.5% | |
|
|
| **4** | Word | 0.0673 ๐ | 1.048 | 1.15 | 4,348,637 | 93.3% | |
|
|
| **4** | Subword | 0.6559 | 1.576 | 3.01 | 467,417 | 34.4% | |
|
|
|
|
|
### Generated Text Samples (Word-based) |
|
|
|
|
|
Below are text samples generated from each word-based Markov chain model: |
|
|
|
|
|
**Context Size 1:** |
|
|
|
|
|
1. `ny masoandro mitatao ho an drenirano sy tsy hita eo amin ny fivavahana iraniana manodidina amin` |
|
|
2. `dia ary maty tamin ny toerana avo indrindra dia tanร na ao amin ny fehiben ny insee` |
|
|
3. `amin ny insee dia degre jereo koa hainkintana zavatra ara daharanjarahasin ilay kaominina ao amin ny` |
|
|
|
|
|
**Context Size 2:** |
|
|
|
|
|
1. `amin ny boribory lavoraryizay antsoina koa hoe excentricitรฉ amin ny soratra desimaly ny faritr i nou...` |
|
|
2. `andro taona au au andro taona karenfletch au au andro taona bomans rg au au andro taona` |
|
|
3. `ao amin ny 0 2 0 3 ary manana hafanana eo amin ny fivondronan i guรฉret ao` |
|
|
|
|
|
**Context Size 3:** |
|
|
|
|
|
1. `au andro taona jb13 au au andro taona ja59 au au andro taona xn45 au au andro taona` |
|
|
2. `au au andro taona tk27 au au andro taona qj2 au au andro taona au au andro taona` |
|
|
3. `ao amin ny vondronosy maley ho aty madagasikara notarihin i roger le goff no ben ny tanร na mandritry` |
|
|
|
|
|
**Context Size 4:** |
|
|
|
|
|
1. `au au andro taona oe4 au au andro taona sq3 au au andro taona au au andro taona om23` |
|
|
2. `au andro taona au au andro taona au au andro taona wp3 au au andro taona xy4 au au` |
|
|
3. `andro taona au au andro taona au au andro taona sg92 au au andro taona au au andro taona` |
|
|
|
|
|
|
|
|
### Generated Text Samples (Subword-based) |
|
|
|
|
|
Below are text samples generated from each subword-based Markov chain model: |
|
|
|
|
|
**Context Size 1:** |
|
|
|
|
|
1. `asogrewwrau)_any` |
|
|
2. `_aom4)_a_eliantr` |
|
|
3. `navony_bamiieser` |
|
|
|
|
|
**Context Size 2:** |
|
|
|
|
|
1. `y_mats.com-ponial` |
|
|
2. `a_dia_sy_hity_sy_` |
|
|
3. `andray_fy_ny_ambo` |
|
|
|
|
|
**Context Size 3:** |
|
|
|
|
|
1. `ny_ary_olomer_sns.` |
|
|
2. `na_rohy_i_juantsah` |
|
|
3. `_ny_ham-panodikoro` |
|
|
|
|
|
**Context Size 4:** |
|
|
|
|
|
1. `_ny_14_dia_mpilala_` |
|
|
2. `amin'_i_bernambarร n` |
|
|
3. `min'_ny_faritimes,_` |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Predictability:** Context-4 (word) with 93.3% predictability |
|
|
- **Branching Factor:** Decreases with context size (more deterministic) |
|
|
- **Memory Trade-off:** Larger contexts require more storage (467,417 contexts) |
|
|
- **Recommendation:** Context-3 or Context-4 for text generation |
|
|
|
|
|
--- |
|
|
## 4. Vocabulary Analysis |
|
|
|
|
|
 |
|
|
|
|
|
 |
|
|
|
|
|
 |
|
|
|
|
|
### Statistics |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| Vocabulary Size | 186,416 | |
|
|
| Total Tokens | 12,311,117 | |
|
|
| Mean Frequency | 66.04 | |
|
|
| Median Frequency | 3 | |
|
|
| Frequency Std Dev | 4301.01 | |
|
|
|
|
|
### Most Common Words |
|
|
|
|
|
| Rank | Word | Frequency | |
|
|
|------|------|-----------| |
|
|
| 1 | ny | 1,518,386 | |
|
|
| 2 | dia | 465,913 | |
|
|
| 3 | amin | 435,633 | |
|
|
| 4 | au | 412,623 | |
|
|
| 5 | i | 399,465 | |
|
|
| 6 | taona | 314,686 | |
|
|
| 7 | ao | 283,721 | |
|
|
| 8 | andro | 214,534 | |
|
|
| 9 | ary | 149,725 | |
|
|
| 10 | tamin | 113,939 | |
|
|
|
|
|
### Least Common Words (from vocabulary) |
|
|
|
|
|
| Rank | Word | Frequency | |
|
|
|------|------|-----------| |
|
|
| 1 | clavaud | 2 | |
|
|
| 2 | holaboay | 2 | |
|
|
| 3 | olaboay | 2 | |
|
|
| 4 | marggie | 2 | |
|
|
| 5 | xiomara | 2 | |
|
|
| 6 | tapias | 2 | |
|
|
| 7 | firmo | 2 | |
|
|
| 8 | gentofte | 2 | |
|
|
| 9 | amalienborg | 2 | |
|
|
| 10 | vyborg | 2 | |
|
|
|
|
|
### Zipf's Law Analysis |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| Zipf Coefficient | 1.2392 | |
|
|
| Rยฒ (Goodness of Fit) | 0.998231 | |
|
|
| Adherence Quality | **excellent** | |
|
|
|
|
|
### Coverage Analysis |
|
|
|
|
|
| Top N Words | Coverage | |
|
|
|-------------|----------| |
|
|
| Top 100 | 60.0% | |
|
|
| Top 1,000 | 81.4% | |
|
|
| Top 5,000 | 89.6% | |
|
|
| Top 10,000 | 92.3% | |
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Zipf Compliance:** Rยฒ=0.9982 indicates excellent adherence to Zipf's law |
|
|
- **High Frequency Dominance:** Top 100 words cover 60.0% of corpus |
|
|
- **Long Tail:** 176,416 words needed for remaining 7.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.8042 | 0.3503 | N/A | N/A | |
|
|
| **mono_64d** | 64 | 0.7680 | 0.2980 | N/A | N/A | |
|
|
| **mono_128d** | 128 | 0.7205 | 0.2509 | N/A | N/A | |
|
|
| **aligned_32d** | 32 | 0.8042 ๐ | 0.3596 | 0.0820 | 0.3280 | |
|
|
| **aligned_64d** | 64 | 0.7680 | 0.2994 | 0.1540 | 0.4960 | |
|
|
| **aligned_128d** | 128 | 0.7205 | 0.2597 | 0.2000 | 0.5660 | |
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Isotropy:** aligned_32d with 0.8042 (more uniform distribution) |
|
|
- **Semantic Density:** Average pairwise similarity of 0.3030. Lower values indicate better semantic separation. |
|
|
- **Alignment Quality:** Aligned models achieve up to 20.0% 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.070** | 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 | |
|
|
|--------|----------| |
|
|
| `-s` | stenopetalum, stenay, sumiyoshi | |
|
|
| `-a` | andriamarobasy, anggun, aboville | |
|
|
| `-r` | reignat, rm97, raty | |
|
|
| `-t` | tm67, td34, tp34 | |
|
|
| `-c` | christensen, ce6, celentano | |
|
|
| `-b` | bakkoury, bev, bakr | |
|
|
| `-f` | famantaranavaratra, frisano, fanandraman | |
|
|
| `-g` | gp6, gq54, gc61 | |
|
|
|
|
|
#### Productive Suffixes |
|
|
| Suffix | Examples | |
|
|
|--------|----------| |
|
|
| `-a` | donnera, kwaลniewska, famantaranavaratra | |
|
|
| `-na` | fanasokajiana, andaminana, hampijoroana | |
|
|
| `-n` | nosoniavin, anggun, christensen | |
|
|
| `-s` | pรฉgairolles, aups, tauxiรจres | |
|
|
| `-e` | aboville, bartole, louze | |
|
|
| `-y` | andriamarobasy, namitany, stenay | |
|
|
| `-o` | frisano, celentano, shapiro | |
|
|
| `-i` | oerstedii, sumiyoshi, salviani | |
|
|
|
|
|
### 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 | |
|
|
|------|----------|------------------|----------| |
|
|
| `inin` | 2.33x | 55 contexts | minin, vining, jining | |
|
|
| `indr` | 1.81x | 124 contexts | indre, indri, indry | |
|
|
| `andr` | 1.49x | 336 contexts | andry, andro, andra | |
|
|
| `ndra` | 1.67x | 176 contexts | ondra, andra, indra | |
|
|
| `itra` | 1.69x | 141 contexts | mitra, ritra, kitra | |
|
|
| `iana` | 1.64x | 164 contexts | kiana, riana, niana | |
|
|
| `ndri` | 1.63x | 161 contexts | endri, indri, andri | |
|
|
| `ants` | 1.70x | 116 contexts | sants, antsa, wants | |
|
|
| `ahar` | 1.66x | 111 contexts | nahar, bahar, ahary | |
|
|
| `ndro` | 1.58x | 111 contexts | andro, indro, androy | |
|
|
| `inta` | 1.74x | 60 contexts | vinta, linta, kinta | |
|
|
| `ntan` | 1.49x | 111 contexts | entan, entana, antany | |
|
|
|
|
|
### 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 | |
|
|
|--------|--------|-----------|----------| |
|
|
| `-a` | `-a` | 134 words | ansikilika, aminata | |
|
|
| `-f` | `-a` | 128 words | fanononana, fanaparitahana | |
|
|
| `-f` | `-na` | 105 words | fanononana, fanaparitahana | |
|
|
| `-h` | `-a` | 103 words | hetaheta, hamitika | |
|
|
| `-t` | `-a` | 77 words | theodosia, tuberifera | |
|
|
| `-s` | `-a` | 64 words | serrania, sirasida | |
|
|
| `-f` | `-n` | 62 words | furlan, flaxman | |
|
|
| `-c` | `-s` | 61 words | citรฉes, cisterciensis | |
|
|
| `-a` | `-na` | 56 words | alamร na, andriankotonavalona | |
|
|
| `-b` | `-a` | 52 words | bizantioma, botovasoa | |
|
|
|
|
|
### 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 | |
|
|
|------|-----------------|------------|------| |
|
|
| miratoerana | **`mi-ra-toerana`** | 7.5 | `toerana` | |
|
|
| namoronany | **`namoro-na-ny`** | 7.5 | `na` | |
|
|
| fanakanana | **`fanaka-na-na`** | 7.5 | `na` | |
|
|
| newfoundland | **`newfoundl-an-d`** | 7.5 | `an` | |
|
|
| fampitany | **`fampit-a-ny`** | 7.5 | `a` | |
|
|
| firenenena | **`firenen-e-na`** | 7.5 | `e` | |
|
|
| holazainao | **`holazai-na-o`** | 7.5 | `na` | |
|
|
| boetticher | **`boetti-ch-er`** | 7.5 | `ch` | |
|
|
| cucurbiteae | **`cucurbite-a-e`** | 7.5 | `a` | |
|
|
| cobergher | **`coberg-h-er`** | 7.5 | `h` | |
|
|
| fankanesana | **`fankanes-a-na`** | 7.5 | `a` | |
|
|
| fahatoranana | **`fahatora-na-na`** | 7.5 | `na` | |
|
|
| nanohanany | **`nanoha-na-ny`** | 7.5 | `na` | |
|
|
| anamafana | **`anamaf-a-na`** | 7.5 | `a` | |
|
|
| fampirantiana | **`fampiranti-a-na`** | 7.5 | `a` | |
|
|
|
|
|
### 6.6 Linguistic Interpretation |
|
|
|
|
|
> **Automated Insight:** |
|
|
The language Malagasy 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 (4.46x) | |
|
|
| N-gram | **2-gram** | Lowest perplexity (188) | |
|
|
| Markov | **Context-4** | Highest predictability (93.3%) | |
|
|
| 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 12:09:55* |
|
|
|