af / README.md
omarkamali's picture
Upload all models and assets for af (20251001)
e1730cc verified
metadata
language: af
language_name: AF
language_family: germanic_west_anglofrisian
tags:
  - wikilangs
  - nlp
  - tokenizer
  - embeddings
  - n-gram
  - markov
  - wikipedia
  - monolingual
  - family-germanic_west_anglofrisian
license: mit
library_name: wikilangs
pipeline_tag: feature-extraction
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.62
  - name: best_isotropy
    type: isotropy
    value: 0.6959
  - name: vocabulary_size
    type: vocab
    value: 0
generated: 2026-01-03T00:00:00.000Z

AF - Wikilangs Models

Comprehensive Research Report & Full Ablation Study

This repository contains NLP models trained and evaluated by Wikilangs, specifically on AF 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

Performance Dashboard

Analysis and Evaluation


1. Tokenizer Evaluation

Tokenizer Compression

Tokenizer Fertility

Tokenizer OOV

Total Tokens

Results

Vocab Size Compression Avg Token Len UNK Rate Total Tokens
8k 3.747x 3.75 0.0650% 1,240,279
16k 4.108x 4.11 0.0712% 1,131,351
32k 4.402x 4.40 0.0763% 1,055,895
64k 4.620x 🏆 4.62 0.0801% 1,006,125

Tokenization Examples

Below are sample sentences tokenized with each vocabulary size:

Sample 1: Neede is ’n dorp in die munisipaliteit Berkelland in die provinsie Gelderland in...

Vocab Tokens Count
8k ▁ne e de ▁is ▁’ n ▁dorp ▁in ▁die ▁munisipaliteit ... (+14 more) 24
16k ▁ne ede ▁is ▁’ n ▁dorp ▁in ▁die ▁munisipaliteit ▁berk ... (+13 more) 23
32k ▁ne ede ▁is ▁’ n ▁dorp ▁in ▁die ▁munisipaliteit ▁berk ... (+13 more) 23
64k ▁ne ede ▁is ▁’ n ▁dorp ▁in ▁die ▁munisipaliteit ▁berkelland ... (+12 more) 22

Sample 2: Japan Nasionale Roete 210 is 'n nasionale snelweg in Japan. Verwysings paaie in ...

Vocab Tokens Count
8k ▁japan ▁nasionale ▁roete ▁ 2 1 0 ▁is ▁' n ... (+9 more) 19
16k ▁japan ▁nasionale ▁roete ▁ 2 1 0 ▁is ▁' n ... (+9 more) 19
32k ▁japan ▁nasionale ▁roete ▁ 2 1 0 ▁is ▁' n ... (+9 more) 19
64k ▁japan ▁nasionale ▁roete ▁ 2 1 0 ▁is ▁' n ... (+9 more) 19

Sample 3: Ja'Net DuBois (gebore 5 Augustus – 17 Februarie was 'n Amerikaanse aktrise. Ekst...

Vocab Tokens Count
8k ▁ja ' net ▁dub ois ▁( gebore ▁ 5 ▁augustus ... (+30 more) 40
16k ▁ja ' net ▁dub ois ▁( gebore ▁ 5 ▁augustus ... (+30 more) 40
32k ▁ja ' net ▁dub ois ▁( gebore ▁ 5 ▁augustus ... (+30 more) 40
64k ▁ja ' net ▁dubois ▁( gebore ▁ 5 ▁augustus ▁– ... (+29 more) 39

Key Findings

  • Best Compression: 64k achieves 4.620x compression
  • Lowest UNK Rate: 8k with 0.0650% 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

N-gram Perplexity

N-gram Unique

N-gram Coverage

Results

N-gram Variant Perplexity Entropy Unique N-grams Top-100 Coverage Top-1000 Coverage
2-gram Word 67,018 16.03 738,183 13.7% 29.1%
2-gram Subword 253 🏆 7.98 13,576 69.5% 99.3%
3-gram Word 293,932 18.17 1,499,483 5.8% 16.9%
3-gram Subword 2,161 11.08 96,263 28.5% 71.9%
4-gram Word 555,388 19.08 2,510,434 6.5% 16.6%
4-gram Subword 12,658 13.63 531,540 15.0% 40.0%

Top 5 N-grams by Size

2-grams (Word):

Rank N-gram Count
1 van die 509,583
2 in die 342,810
3 is n 114,159
4 en die 109,201
5 is die 91,083

3-grams (Word):

Rank N-gram Count
1 van suid afrika 26,860
2 rolle in die 25,216
3 die 20ste eeu 24,460
4 van die 20ste 23,487
5 eksterne skakels in 22,326

4-grams (Word):

Rank N-gram Count
1 van die 20ste eeu 23,423
2 manlike akteurs van die 20,397
3 rolle in die rolprente 19,639
4 van die 21ste eeu 15,799
5 plants of the world 13,996

2-grams (Subword):

Rank N-gram Count
1 e _ 8,883,972
2 n _ 5,845,355
3 i e 5,296,532
4 e r 4,795,609
5 _ d 4,496,380

3-grams (Subword):

Rank N-gram Count
1 i e _ 3,582,000
2 _ d i 3,169,450
3 d i e 3,046,581
4 a n _ 1,886,278
5 e n _ 1,538,281

4-grams (Subword):

Rank N-gram Count
1 d i e _ 2,916,346
2 _ d i e 2,836,188
3 _ v a n 1,357,382
4 v a n _ 1,341,795
5 n _ d i 1,169,352

Key Findings

  • Best Perplexity: 2-gram (subword) with 253
  • Entropy Trend: Decreases with larger n-grams (more predictable)
  • Coverage: Top-1000 patterns cover ~40% of corpus
  • Recommendation: 4-gram or 5-gram for best predictive performance

3. Markov Chain Evaluation

Markov Entropy

Markov Contexts

Markov Branching

Results

Context Variant Avg Entropy Perplexity Branching Factor Unique Contexts Predictability
1 Word 0.9426 1.922 9.97 884,548 5.7%
1 Subword 1.0721 2.102 6.58 7,654 0.0%
2 Word 0.3842 1.305 2.33 8,810,967 61.6%
2 Subword 0.7311 1.660 4.61 50,359 26.9%
3 Word 0.1707 1.126 1.40 20,525,798 82.9%
3 Subword 0.7061 1.631 4.02 231,918 29.4%
4 Word 0.0704 🏆 1.050 1.13 28,628,609 93.0%
4 Subword 0.6911 1.615 3.50 931,942 30.9%

Generated Text Samples (Word-based)

Below are text samples generated from each word-based Markov chain model:

Context Size 1:

  1. die burger 13 augustus se fsa nommer vier soldate die uitkoms vir letterkunde in n klein
  2. van soest r amphoriscus cylindrus is in paradise careful he du mont dolent teen 5 6
  3. in die rigting van die twee broers en met die ou teeroete die liberte het die

Context Size 2:

  1. van die spons behoort tot die genus geodia en tot die genus leucadendron behoort en is deur
  2. in die stille oseaan wat tot 4 uur later onder westerse intellektuele invloede gekom frankryk hertog...
  3. is n nuwe telling van 83 etse wat spesiaal vir hierdie liedjie is in die rolprente innerspace

Context Size 3:

  1. rolle in die rolprente the squaw man resurrección kongo the broken wing roaring rails en devils dice...
  2. van die 20ste eeu aktrises van die 21ste eeu mense aktrises van die 21ste eeu aktrises van die
  3. eksterne skakels in manlike akteurs van die 20ste eeu in n stormwind deur pieter kluyver wind is die

Context Size 4:

  1. manlike akteurs van die 20ste eeu aktrises van die 20ste eeu rolprentvervaardigers in mense van die ...
  2. rolle in die rolprente tomorrow when the war began the weekend shift high life tidelands eksterne sk...
  3. plants of the world online van suid afrika plante van suid afrika gramineum

Generated Text Samples (Subword-based)

Below are text samples generated from each subword-based Markov chain model:

Context Size 1:

  1. _ho_evise_j._wom
  2. enstein_n_nkt_he
  3. igeked_dig_linid

Context Size 2:

  1. e_nin:_sy_offie_l
  2. n_die_nivir_nbom_
  3. ie_uikaide_ver_ro

Context Size 3:

  1. ie_van_die_bespelt
  2. _die_wassen_paropo
  3. die_van_spel_andar

Context Size 4:

  1. die_vonnikeksadige_
  2. _die_branse_levisie
  3. _van_waar_toest,_r.

Key Findings

  • Best Predictability: Context-4 (word) with 93.0% predictability
  • Branching Factor: Decreases with context size (more deterministic)
  • Memory Trade-off: Larger contexts require more storage (931,942 contexts)
  • Recommendation: Context-3 or Context-4 for text generation

4. Vocabulary Analysis

Zipf's Law

Top Words

Coverage Curve

Statistics

Metric Value
Vocabulary Size 403,515
Total Tokens 38,429,571
Mean Frequency 95.24
Median Frequency 4
Frequency Std Dev 6117.62

Most Common Words

Rank Word Frequency
1 die 2,828,931
2 van 1,318,980
3 in 1,109,973
4 en 1,045,922
5 n 802,080
6 is 763,111
7 het 641,876
8 wat 341,748
9 the 292,778
10 op 289,154

Least Common Words (from vocabulary)

Rank Word Frequency
1 williamsville 2
2 1kd 2
3 argiefkopie 2
4 liuzhi 2
5 microsat 2
6 orbex 2
7 afrikanertoekoms 2
8 wêreldkennis 2
9 gastebydraes 2
10 sandkweek 2

Zipf's Law Analysis

Metric Value
Zipf Coefficient 1.0518
R² (Goodness of Fit) 0.996010
Adherence Quality excellent

Coverage Analysis

Top N Words Coverage
Top 100 43.7%
Top 1,000 64.3%
Top 5,000 79.4%
Top 10,000 85.0%

Key Findings

  • Zipf Compliance: R²=0.9960 indicates excellent adherence to Zipf's law
  • High Frequency Dominance: Top 100 words cover 43.7% of corpus
  • Long Tail: 393,515 words needed for remaining 15.0% coverage

5. Word Embeddings Evaluation

Embedding Isotropy

Similarity Matrix

t-SNE Words

t-SNE Sentences

5.1 Cross-Lingual Alignment

Note: Multilingual alignment visualization not available for this language.

5.2 Model Comparison

Model Dimension Isotropy Semantic Density Alignment R@1 Alignment R@10
mono_32d 32 0.6926 0.3664 N/A N/A
mono_64d 64 0.6959 🏆 0.3037 N/A N/A
mono_128d 128 0.6723 0.2366 N/A N/A

Key Findings

  • Best Isotropy: mono_64d with 0.6959 (more uniform distribution)
  • Semantic Density: Average pairwise similarity of 0.3023. Lower values indicate better semantic separation.
  • Alignment Quality: No aligned models evaluated in this run.
  • Recommendation: 128d aligned for best cross-lingual performance

6. Morphological Analysis (Experimental)

⚠️ Warning: This language shows low morphological productivity. The statistical signals used for this analysis may be noisy or less reliable than for morphologically rich languages.

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 0.000 Low morphological productivity ⚠️ Likely unreliable
Idiomaticity Gap -1.000 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
-ge gewandel, gefloreer, getrouheidseed

Productive Suffixes

Suffix Examples
-e kurasse, kortikosteroïde, maatskappyname
-s tuttles, stakings, kenens
-er gefloreer, umbilorivier, koorsanger
-es tuttles, spectres, kladmetodes
-ng kruiskleding, saambring, swangerskapvergiftiging
-ie patagonie, photographie, kriminologie
-ing kruiskleding, saambring, swangerskapvergiftiging
-te monofisiete, skrikwekkendste, curriebekerpunte

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
pren 2.37x 29 contexts prent, prens, prend
staa 1.71x 98 contexts staat, staal, staan
ings 1.53x 145 contexts wings, rings, hings
brui 1.99x 44 contexts bruis, bruid, bruik
kend 1.65x 95 contexts kende, kendo, skend
ebru 2.08x 32 contexts gebru, hebrus, gebruk
ersk 1.54x 107 contexts perske, koersk, perski
erdi 1.61x 84 contexts verdi, ferdi, gerdi
rste 1.42x 150 contexts erste, eerste, fyrste
rdie 1.73x 51 contexts ardie, gordie, jordie
kste 1.54x 71 contexts ekster, tekste, dikste
eken 1.34x 123 contexts weken, deken, oeken

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
-ge -e 63 words geenlokusse, gebruikskode
-ge -de 28 words gebruikskode, geeboniseerde
-ge -er 27 words geigenspieler, getelegrafeer
-ge -s 11 words gemeentesusters, geles
-ge -en 9 words gefahren, gelegen
-ge -te 6 words geskenkte, geweldigste
-ge -ie 5 words getalteorie, geelglasogie
-ge -es 4 words geles, geowetenskaplikes
-ge -ng 2 words geeking, gesondheidsbevordering
-ge -ing 1 words geeking, gesondheidsbevordering

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
gemonteerde ge-monte-er-de 7.5 monte
bevredigende bevredig-en-de 6.0 bevredig
ouditering oudit-er-ing 6.0 oudit
kruiningen kruin-ing-en 6.0 kruin
verlorener verlor-en-er 6.0 verlor
verhardende verhard-en-de 6.0 verhard
bestuifde bestuif-de 4.5 bestuif
behoeften behoeft-en 4.5 behoeft
verminkte vermink-te 4.5 vermink
onreëlmatiger onreëlmatig-er 4.5 onreëlmatig
kollageen kollage-en 4.5 kollage
gekrummel ge-krummel 4.5 krummel
repeterende repet-er-en-de 4.5 repet
gehoorvermoë ge-hoorvermoë 4.5 hoorvermoë
eksoskelette eksoskelet-te 4.5 eksoskelet

6.6 Linguistic Interpretation

Automated Insight: The language AF appears to be more isolating or has a highly fixed vocabulary. Word-level models perform nearly as well as subword models, indicating fewer productive morphological processes.


7. Summary & Recommendations

Performance Dashboard

Production Recommendations

Component Recommended Rationale
Tokenizer 64k BPE Best compression (4.62x)
N-gram 2-gram Lowest perplexity (253)
Markov Context-4 Highest predictability (93.0%)
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 - a monthly snapshot of Wikipedia articles across 300+ languages.

Project

A project by Wikilangs - Open-source NLP models for every Wikipedia language.

Maintainer

Omar Kamali - Omneity Labs

Citation

If you use these models in your research, please cite:

@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


Generated by Wikilangs Models Pipeline

Report Date: 2026-01-03 07:17:29