|
|
--- |
|
|
language: to |
|
|
language_name: Tongan |
|
|
language_family: austronesian_polynesian |
|
|
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_polynesian |
|
|
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.497 |
|
|
- name: best_isotropy |
|
|
type: isotropy |
|
|
value: 0.1197 |
|
|
- name: vocabulary_size |
|
|
type: vocab |
|
|
value: 0 |
|
|
generated: 2026-01-11 |
|
|
--- |
|
|
|
|
|
# Tongan - Wikilangs Models |
|
|
## Comprehensive Research Report & Full Ablation Study |
|
|
|
|
|
This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Tongan** 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.249x | 3.26 | 0.0193% | 181,040 | |
|
|
| **16k** | 3.400x | 3.41 | 0.0202% | 173,006 | |
|
|
| **32k** | 3.497x ๐ | 3.50 | 0.0208% | 168,209 | |
|
|
|
|
|
### Tokenization Examples |
|
|
|
|
|
Below are sample sentences tokenized with each vocabulary size: |
|
|
|
|
|
**Sample 1:** `*E.W. Gifford, Tongan myths and tales, Bernice Pauahi Bishop museum bulletin 8,` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โ* e . w . โgifford , โtongan โmyths โand ... (+10 more)` | 20 | |
|
|
| 16k | `โ* e . w . โgifford , โtongan โmyths โand ... (+10 more)` | 20 | |
|
|
| 32k | `โ* e . w . โgifford , โtongan โmyths โand ... (+10 more)` | 20 | |
|
|
|
|
|
**Sample 2:** `Ko Pulukalia ko ha fonua ia สปi สปEulope. สปi สปEulope` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โko โpuluka lia โko โha โfonua โia โสป i โสป ... (+6 more)` | 16 | |
|
|
| 16k | `โko โpulukalia โko โha โfonua โia โสป i โสป eulope ... (+5 more)` | 15 | |
|
|
| 32k | `โko โpulukalia โko โha โfonua โia โสป i โสป eulope ... (+5 more)` | 15 | |
|
|
|
|
|
**Sample 3:** `*E. Wood-Ellem, Queen Sฤlote of Tonga, Auckland university press,` |
|
|
|
|
|
| Vocab | Tokens | Count | |
|
|
|-------|--------|-------| |
|
|
| 8k | `โ* e . โwood - ellem , โqueen โsฤlote โof ... (+6 more)` | 16 | |
|
|
| 16k | `โ* e . โwood - ellem , โqueen โsฤlote โof ... (+6 more)` | 16 | |
|
|
| 32k | `โ* e . โwood - ellem , โqueen โsฤlote โof ... (+6 more)` | 16 | |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Compression:** 32k achieves 3.497x compression |
|
|
- **Lowest UNK Rate:** 8k with 0.0193% 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 | 948 | 9.89 | 3,349 | 42.1% | 79.1% | |
|
|
| **2-gram** | Subword | 208 ๐ | 7.70 | 1,246 | 74.3% | 99.8% | |
|
|
| **3-gram** | Word | 2,018 | 10.98 | 5,257 | 30.2% | 67.0% | |
|
|
| **3-gram** | Subword | 1,378 | 10.43 | 7,944 | 35.9% | 79.6% | |
|
|
| **4-gram** | Word | 2,947 | 11.53 | 8,403 | 28.6% | 57.9% | |
|
|
| **4-gram** | Subword | 5,492 | 12.42 | 31,079 | 20.2% | 53.5% | |
|
|
| **5-gram** | Word | 1,994 | 10.96 | 5,965 | 34.1% | 63.8% | |
|
|
| **5-gram** | Subword | 12,282 | 13.58 | 57,462 | 14.5% | 40.7% | |
|
|
|
|
|
### Top 5 N-grams by Size |
|
|
|
|
|
**2-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `ko e` | 4,790 | |
|
|
| 2 | `สปi he` | 2,011 | |
|
|
| 3 | `สปo e` | 1,405 | |
|
|
| 4 | `สปa e` | 1,335 | |
|
|
| 5 | `mo e` | 1,134 | |
|
|
|
|
|
**3-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `สปi he ngaahi` | 431 | |
|
|
| 2 | `ko e fuสปu` | 383 | |
|
|
| 3 | `e fuสปu สปakau` | 375 | |
|
|
| 4 | `hingoa สปi he` | 341 | |
|
|
| 5 | `he ngaahi lea` | 336 | |
|
|
|
|
|
**4-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `ko e fuสปu สปakau` | 365 | |
|
|
| 2 | `สปi he ngaahi lea` | 335 | |
|
|
| 3 | `he ngaahi lea kehe` | 331 | |
|
|
| 4 | `hingoa สปi he ngaahi` | 328 | |
|
|
| 5 | `vaสปa fekumi ngoue vainฤซ` | 309 | |
|
|
|
|
|
**5-grams (Word):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `สปi he ngaahi lea kehe` | 331 | |
|
|
| 2 | `hingoa สปi he ngaahi lea` | 328 | |
|
|
| 3 | `hokohoko ngaahi สปakau vaสปa fekumi` | 309 | |
|
|
| 4 | `ngaahi สปakau vaสปa fekumi ngoue` | 309 | |
|
|
| 5 | `สปakau vaสปa fekumi ngoue vainฤซ` | 309 | |
|
|
|
|
|
**2-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `e _` | 28,242 | |
|
|
| 2 | `a _` | 24,953 | |
|
|
| 3 | `i _` | 22,182 | |
|
|
| 4 | `o _` | 19,549 | |
|
|
| 5 | `_ สป` | 19,509 | |
|
|
|
|
|
**3-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `_ e _` | 9,332 | |
|
|
| 2 | `n g a` | 8,789 | |
|
|
| 3 | `k o _` | 7,921 | |
|
|
| 4 | `h e _` | 7,566 | |
|
|
| 5 | `o _ e` | 7,505 | |
|
|
|
|
|
**4-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `o _ e _` | 7,450 | |
|
|
| 2 | `_ k o _` | 5,828 | |
|
|
| 3 | `k o _ e` | 4,823 | |
|
|
| 4 | `_ h e _` | 4,523 | |
|
|
| 5 | `_ สป i _` | 3,803 | |
|
|
|
|
|
**5-grams (Subword):** |
|
|
|
|
|
| Rank | N-gram | Count | |
|
|
|------|--------|-------| |
|
|
| 1 | `k o _ e _` | 4,799 | |
|
|
| 2 | `_ k o _ e` | 4,059 | |
|
|
| 3 | `i _ h e _` | 3,520 | |
|
|
| 4 | `_ f a k a` | 3,147 | |
|
|
| 5 | `สป o k u _` | 2,999 | |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Perplexity:** 2-gram (subword) with 208 |
|
|
- **Entropy Trend:** Decreases with larger n-grams (more predictable) |
|
|
- **Coverage:** Top-1000 patterns cover ~41% 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.7580 | 1.691 | 4.11 | 15,572 | 24.2% | |
|
|
| **1** | Subword | 0.8923 | 1.856 | 6.74 | 432 | 10.8% | |
|
|
| **2** | Word | 0.2407 | 1.182 | 1.56 | 63,563 | 75.9% | |
|
|
| **2** | Subword | 0.9268 | 1.901 | 5.18 | 2,905 | 7.3% | |
|
|
| **3** | Word | 0.1088 | 1.078 | 1.20 | 98,178 | 89.1% | |
|
|
| **3** | Subword | 0.7964 | 1.737 | 3.51 | 15,009 | 20.4% | |
|
|
| **4** | Word | 0.0474 ๐ | 1.033 | 1.07 | 116,582 | 95.3% | |
|
|
| **4** | Subword | 0.5667 | 1.481 | 2.28 | 52,648 | 43.3% | |
|
|
|
|
|
### Generated Text Samples (Word-based) |
|
|
|
|
|
Below are text samples generated from each word-based Markov chain model: |
|
|
|
|
|
**Context Size 1:** |
|
|
|
|
|
1. `e limufonua ko e สปakau kฤlava maสปa e ongo foha สปo tonga land acts v l` |
|
|
2. `ko e vahe hihifo สปo e meสปa kelekele mo e matalaสปiสปakau kula kuusi ko e lotu` |
|
|
3. `he ngaahi lau สปoku mamaha สปa ha alaufuli pea สปoku ui foki ko e pฤซ pea` |
|
|
|
|
|
**Context Size 2:** |
|
|
|
|
|
1. `ko e motuสปa feituสปu สปi he talatupuสปa สปo สปahoสปeitu สปi he taimi ni koeสปuhi สปenau hiki ki` |
|
|
2. `สปi he ngaahi lea kehe สปara lea fakakuki kalabuci damu lea fakafisi pลซrau lea fakatahisi hutu he` |
|
|
3. `สปo e lea heliaki ko e matapฤ สปeni tokua naสปe สปomi ki tongรก ni สปi tongรก ni` |
|
|
|
|
|
**Context Size 3:** |
|
|
|
|
|
1. `สปi he ngaahi lea kehe tลmฤti lea fakakuki lea fakatahisi สปลhiสปa ma ka nahele lea fakahauaiสปi s pimpi...` |
|
|
2. `ko e fuสปu สปakau lahi ia สปoku tupu ofi ki he haสปamonga สปa maui pupunga fetuสปu ko e` |
|
|
3. `e fuสปu สปakau siสปi ia mei he สปatamai สปo mฤmani สปa ia สปoku hoko ai สปa e ngaahi` |
|
|
|
|
|
**Context Size 4:** |
|
|
|
|
|
1. `ko e fuสปu สปakau lahi ia mo e ngaahi ngeสปesi สปelilivao สปoku ui ko e nati foki สปoku kulokula` |
|
|
2. `สปi he ngaahi lea kehe mฤkeke lea fakahauaiสปi masitati kapisi lea fakahaสปamoa kฤpati lea fakakuki pฤซn...` |
|
|
3. `he ngaahi lea kehe toua lea fakaniuฤ malina lea fakahaสปamoa rลpiฤni piฤni lea fakakuki tataku hokoho...` |
|
|
|
|
|
|
|
|
### Generated Text Samples (Subword-based) |
|
|
|
|
|
Below are text samples generated from each subword-based Markov chain model: |
|
|
|
|
|
**Context Size 1:** |
|
|
|
|
|
1. `_nofo_pue,_kae_b` |
|
|
2. `au,_hi_ngaสปau_i_` |
|
|
3. `ita_hi_ctowo_สปot` |
|
|
|
|
|
**Context Size 2:** |
|
|
|
|
|
1. `e_ressia_motonga_` |
|
|
2. `a_kฤ_ku_meสปa,_por` |
|
|
3. `i_loquene,_va_โe_` |
|
|
|
|
|
**Context Size 3:** |
|
|
|
|
|
1. `_e_pea._ko_e_ngaah` |
|
|
2. `ngaahi_aสปu._kolo_สป` |
|
|
3. `ko_hono_puสปangua_s` |
|
|
|
|
|
**Context Size 4:** |
|
|
|
|
|
1. `o_e_hine_taha_micro` |
|
|
2. `_ko_e_tuituitaha_ko` |
|
|
3. `ko_e_taha_kฤ_ko_e_h` |
|
|
|
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Predictability:** Context-4 (word) with 95.3% predictability |
|
|
- **Branching Factor:** Decreases with context size (more deterministic) |
|
|
- **Memory Trade-off:** Larger contexts require more storage (52,648 contexts) |
|
|
- **Recommendation:** Context-3 or Context-4 for text generation |
|
|
|
|
|
--- |
|
|
## 4. Vocabulary Analysis |
|
|
|
|
|
 |
|
|
|
|
|
 |
|
|
|
|
|
 |
|
|
|
|
|
### Statistics |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| Vocabulary Size | 6,787 | |
|
|
| Total Tokens | 149,227 | |
|
|
| Mean Frequency | 21.99 | |
|
|
| Median Frequency | 3 | |
|
|
| Frequency Std Dev | 193.13 | |
|
|
|
|
|
### Most Common Words |
|
|
|
|
|
| Rank | Word | Frequency | |
|
|
|------|------|-----------| |
|
|
| 1 | e | 9,737 | |
|
|
| 2 | ko | 7,170 | |
|
|
| 3 | he | 4,551 | |
|
|
| 4 | สปi | 3,854 | |
|
|
| 5 | สปo | 3,196 | |
|
|
| 6 | สปoku | 2,983 | |
|
|
| 7 | ia | 2,271 | |
|
|
| 8 | ngaahi | 2,189 | |
|
|
| 9 | สปa | 2,030 | |
|
|
| 10 | mo | 1,983 | |
|
|
|
|
|
### Least Common Words (from vocabulary) |
|
|
|
|
|
| Rank | Word | Frequency | |
|
|
|------|------|-----------| |
|
|
| 1 | fohi | 2 | |
|
|
| 2 | tekau | 2 | |
|
|
| 3 | fakapฤ | 2 | |
|
|
| 4 | fahaสปi | 2 | |
|
|
| 5 | mutumutu | 2 | |
|
|
| 6 | kokรก | 2 | |
|
|
| 7 | mahoaสปรก | 2 | |
|
|
| 8 | kaรญ | 2 | |
|
|
| 9 | lauสปolungรก | 2 | |
|
|
| 10 | folahi | 2 | |
|
|
|
|
|
### Zipf's Law Analysis |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| Zipf Coefficient | 1.1311 | |
|
|
| Rยฒ (Goodness of Fit) | 0.992429 | |
|
|
| Adherence Quality | **excellent** | |
|
|
|
|
|
### Coverage Analysis |
|
|
|
|
|
| Top N Words | Coverage | |
|
|
|-------------|----------| |
|
|
| Top 100 | 56.6% | |
|
|
| Top 1,000 | 83.9% | |
|
|
| Top 5,000 | 97.6% | |
|
|
| Top 10,000 | 0.0% | |
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Zipf Compliance:** Rยฒ=0.9924 indicates excellent adherence to Zipf's law |
|
|
- **High Frequency Dominance:** Top 100 words cover 56.6% of corpus |
|
|
- **Long Tail:** -3,213 words needed for remaining 100.0% 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.1197 ๐ | 0.5003 | N/A | N/A | |
|
|
| **mono_64d** | 64 | 0.0193 | 0.5134 | N/A | N/A | |
|
|
| **mono_128d** | 128 | 0.0028 | 0.4946 | N/A | N/A | |
|
|
| **aligned_32d** | 32 | 0.1197 | 0.4991 | 0.0100 | 0.0900 | |
|
|
| **aligned_64d** | 64 | 0.0193 | 0.5081 | 0.0140 | 0.0980 | |
|
|
| **aligned_128d** | 128 | 0.0028 | 0.5043 | 0.0140 | 0.0920 | |
|
|
|
|
|
### Key Findings |
|
|
|
|
|
- **Best Isotropy:** mono_32d with 0.1197 (more uniform distribution) |
|
|
- **Semantic Density:** Average pairwise similarity of 0.5033. Lower values indicate better semantic separation. |
|
|
- **Alignment Quality:** Aligned models achieve up to 1.4% 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.569** | High formulaic/idiomatic 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 | |
|
|
|--------|----------| |
|
|
| `-t` | translation, totokamaka, tooi | |
|
|
| `-s` | seen, state, surely | |
|
|
| `-m` | mole, maสปamaสปa, menemene | |
|
|
| `-p` | parazoa, puna, palm | |
|
|
| `-ma` | maสปamaสปa, mamata, masipฤ | |
|
|
| `-f` | foo, fimbristylis, floribunda | |
|
|
| `-l` | lafalafa, laufale, longomapu | |
|
|
| `-k` | kฤkฤ, kelenatฤ, kakamika | |
|
|
|
|
|
#### Productive Suffixes |
|
|
| Suffix | Examples | |
|
|
|--------|----------| |
|
|
| `-a` | สปekea, floribunda, maสปamaสปa | |
|
|
| `-i` | hui, tooi, tuki | |
|
|
| `-e` | mole, because, menemene | |
|
|
| `-u` | tatafu, longomapu, tฤupoสปou | |
|
|
| `-s` | fimbristylis, berenices, occidentalis | |
|
|
| `-o` | foo, epikopo, sio | |
|
|
| `-ia` | pilitania, สปaositelฤlia, terminalia | |
|
|
| `-ga` | moสปunga, hengehenga, taunga | |
|
|
|
|
|
### 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 | |
|
|
|------|----------|------------------|----------| |
|
|
| `akat` | 1.59x | 25 contexts | kakato, fakatu, fakatลซ | |
|
|
| `onga` | 1.41x | 25 contexts | konga, tonga, nonga | |
|
|
| `ngat` | 1.64x | 15 contexts | ngata, ngatรบ, ngatu | |
|
|
| `สปang` | 1.66x | 12 contexts | สปanga, paสปanga, hลซสปanga | |
|
|
| `kata` | 1.53x | 15 contexts | katafa, fakatau, akataha | |
|
|
| `kala` | 1.38x | 19 contexts | kalae, kalasi, kakala | |
|
|
| `hing` | 1.53x | 13 contexts | thing, hinga, ahinga | |
|
|
| `สปaka` | 1.71x | 8 contexts | สปakau, สปakaรบ, สปakana | |
|
|
| `akah` | 1.56x | 10 contexts | fakahลซ, fakaha, fakahฤ | |
|
|
| `tata` | 1.49x | 11 contexts | tatau, tatafu, tatala | |
|
|
| `akal` | 1.48x | 11 contexts | kakala, fakalao, fakalau | |
|
|
| `ahin` | 1.48x | 10 contexts | vahine, ahinga, mahino | |
|
|
|
|
|
### 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 | |
|
|
|--------|--------|-----------|----------| |
|
|
| `-f` | `-a` | 152 words | floribunda, fukofuka | |
|
|
| `-t` | `-a` | 143 words | totokamaka, taunga | |
|
|
| `-f` | `-i` | 123 words | fakafefiofi, falevai | |
|
|
| `-m` | `-a` | 122 words | maสปamaสปa, moสปunga | |
|
|
| `-สป` | `-a` | 77 words | สปekea, สปalava | |
|
|
| `-t` | `-u` | 74 words | tatafu, tฤupoสปou | |
|
|
| `-t` | `-i` | 70 words | tooi, tuki | |
|
|
| `-p` | `-a` | 66 words | parazoa, puna | |
|
|
| `-l` | `-a` | 64 words | lafalafa, laveสปimoa | |
|
|
| `-k` | `-a` | 52 words | kakamika, kulukona | |
|
|
|
|
|
### 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 | |
|
|
|------|-----------------|------------|------| |
|
|
| สปafilikani | **`สปafilik-a-ni`** | 7.5 | `a` | |
|
|
| fetuสปutaki | **`fetuสปut-a-ki`** | 7.5 | `a` | |
|
|
| talafoสปou | **`ta-la-foสปou`** | 7.5 | `foสปou` | |
|
|
| fakataimi | **`fa-ka-taimi`** | 7.5 | `taimi` | |
|
|
| fehokotaki | **`fehokot-a-ki`** | 7.5 | `a` | |
|
|
| polotonga | **`po-lo-tonga`** | 7.5 | `tonga` | |
|
|
| sterninae | **`sternin-a-e`** | 7.5 | `a` | |
|
|
| christian | **`christi-a-n`** | 7.5 | `a` | |
|
|
| lauraceae | **`laurace-a-e`** | 7.5 | `a` | |
|
|
| siulolovao | **`siulolov-a-o`** | 7.5 | `a` | |
|
|
| vavalangi | **`va-va-langi`** | 7.5 | `langi` | |
|
|
| grossulariaceae | **`grossulariace-a-e`** | 7.5 | `a` | |
|
|
| fakakakai | **`fakakak-a-i`** | 7.5 | `a` | |
|
|
| matafanga | **`ma-ta-fanga`** | 7.5 | `fanga` | |
|
|
| afuhaสปapai | **`afuhaสปap-a-i`** | 7.5 | `a` | |
|
|
|
|
|
### 6.6 Linguistic Interpretation |
|
|
|
|
|
> **Automated Insight:** |
|
|
The language Tongan shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding. |
|
|
|
|
|
> **Note on Idiomaticity:** The high Idiomaticity Gap suggests a large number of frequent multi-word expressions or formulaic sequences that are statistically distinct from their component parts. |
|
|
|
|
|
--- |
|
|
## 7. Summary & Recommendations |
|
|
|
|
|
 |
|
|
|
|
|
### Production Recommendations |
|
|
|
|
|
| Component | Recommended | Rationale | |
|
|
|-----------|-------------|-----------| |
|
|
| Tokenizer | **32k BPE** | Best compression (3.50x) | |
|
|
| N-gram | **2-gram** | Lowest perplexity (208) | |
|
|
| Markov | **Context-4** | Highest predictability (95.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-11 01:22:47* |
|
|
|