omarkamali commited on
Commit
4ce217a
·
verified ·
1 Parent(s): 0bd9e3a

Upload all models and assets for es (latest)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +7 -0
  2. README.md +230 -0
  3. RESEARCH_REPORT.md +686 -0
  4. es_morph_tokenizer.json +0 -0
  5. models/embeddings/aligned/es_128d.bin +3 -0
  6. models/embeddings/aligned/es_128d.meta.json +1 -0
  7. models/embeddings/aligned/es_128d.projection.npy +3 -0
  8. models/embeddings/aligned/es_128d_metadata.json +8 -0
  9. models/embeddings/aligned/es_32d.bin +3 -0
  10. models/embeddings/aligned/es_32d.meta.json +1 -0
  11. models/embeddings/aligned/es_32d.projection.npy +3 -0
  12. models/embeddings/aligned/es_32d_metadata.json +8 -0
  13. models/embeddings/aligned/es_64d.bin +3 -0
  14. models/embeddings/aligned/es_64d.meta.json +1 -0
  15. models/embeddings/aligned/es_64d.projection.npy +3 -0
  16. models/embeddings/aligned/es_64d_metadata.json +8 -0
  17. models/embeddings/monolingual/es_128d.bin +3 -0
  18. models/embeddings/monolingual/es_128d.meta.json +1 -0
  19. models/embeddings/monolingual/es_128d_metadata.json +16 -0
  20. models/embeddings/monolingual/es_32d.bin +3 -0
  21. models/embeddings/monolingual/es_32d.meta.json +1 -0
  22. models/embeddings/monolingual/es_32d_metadata.json +16 -0
  23. models/embeddings/monolingual/es_64d.bin +3 -0
  24. models/embeddings/monolingual/es_64d.meta.json +1 -0
  25. models/embeddings/monolingual/es_64d_metadata.json +16 -0
  26. models/subword_markov/es_markov_ctx1_subword.parquet +3 -0
  27. models/subword_markov/es_markov_ctx1_subword_metadata.json +7 -0
  28. models/subword_markov/es_markov_ctx2_subword.parquet +3 -0
  29. models/subword_markov/es_markov_ctx2_subword_metadata.json +7 -0
  30. models/subword_markov/es_markov_ctx3_subword.parquet +3 -0
  31. models/subword_markov/es_markov_ctx3_subword_metadata.json +7 -0
  32. models/subword_markov/es_markov_ctx4_subword.parquet +3 -0
  33. models/subword_markov/es_markov_ctx4_subword_metadata.json +7 -0
  34. models/subword_ngram/es_2gram_subword.parquet +3 -0
  35. models/subword_ngram/es_2gram_subword_metadata.json +7 -0
  36. models/subword_ngram/es_3gram_subword.parquet +3 -0
  37. models/subword_ngram/es_3gram_subword_metadata.json +7 -0
  38. models/subword_ngram/es_4gram_subword.parquet +3 -0
  39. models/subword_ngram/es_4gram_subword_metadata.json +7 -0
  40. models/subword_ngram/es_5gram_subword.parquet +3 -0
  41. models/subword_ngram/es_5gram_subword_metadata.json +7 -0
  42. models/tokenizer/es_tokenizer_16k.model +3 -0
  43. models/tokenizer/es_tokenizer_16k.vocab +0 -0
  44. models/tokenizer/es_tokenizer_32k.model +3 -0
  45. models/tokenizer/es_tokenizer_32k.vocab +0 -0
  46. models/tokenizer/es_tokenizer_64k.model +3 -0
  47. models/tokenizer/es_tokenizer_64k.vocab +0 -0
  48. models/tokenizer/es_tokenizer_8k.model +3 -0
  49. models/tokenizer/es_tokenizer_8k.vocab +0 -0
  50. models/vocabulary/es_vocabulary.parquet +3 -0
.gitattributes CHANGED
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ visualizations/embedding_similarity.png filter=lfs diff=lfs merge=lfs -text
37
+ visualizations/embedding_tsne_multilingual.png filter=lfs diff=lfs merge=lfs -text
38
+ visualizations/performance_dashboard.png filter=lfs diff=lfs merge=lfs -text
39
+ visualizations/position_encoding_comparison.png filter=lfs diff=lfs merge=lfs -text
40
+ visualizations/tsne_sentences.png filter=lfs diff=lfs merge=lfs -text
41
+ visualizations/tsne_words.png filter=lfs diff=lfs merge=lfs -text
42
+ visualizations/zipf_law.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: es
3
+ language_name: Spanish
4
+ language_family: romance_iberian
5
+ tags:
6
+ - wikilangs
7
+ - nlp
8
+ - tokenizer
9
+ - embeddings
10
+ - n-gram
11
+ - markov
12
+ - wikipedia
13
+ - feature-extraction
14
+ - sentence-similarity
15
+ - tokenization
16
+ - n-grams
17
+ - markov-chain
18
+ - text-mining
19
+ - fasttext
20
+ - babelvec
21
+ - vocabulous
22
+ - vocabulary
23
+ - monolingual
24
+ - family-romance_iberian
25
+ license: mit
26
+ library_name: wikilangs
27
+ pipeline_tag: text-generation
28
+ datasets:
29
+ - omarkamali/wikipedia-monthly
30
+ dataset_info:
31
+ name: wikipedia-monthly
32
+ description: Monthly snapshots of Wikipedia articles across 300+ languages
33
+ metrics:
34
+ - name: best_compression_ratio
35
+ type: compression
36
+ value: 4.831
37
+ - name: best_isotropy
38
+ type: isotropy
39
+ value: 0.7898
40
+ - name: best_alignment_r10
41
+ type: alignment
42
+ value: 0.9680
43
+ - name: vocabulary_size
44
+ type: vocab
45
+ value: 1128398
46
+ generated: 2026-03-04
47
+ ---
48
+
49
+ # Spanish — Wikilangs Models
50
+
51
+ Open-source tokenizers, n-gram & Markov language models, vocabulary stats, and word embeddings trained on **Spanish** Wikipedia by [Wikilangs](https://wikilangs.org).
52
+
53
+ 🌐 [Language Page](https://wikilangs.org/languages/es/) · 🎮 [Playground](https://wikilangs.org/playground/?lang=es) · 📊 [Full Research Report](RESEARCH_REPORT.md)
54
+
55
+ ## Language Samples
56
+
57
+ Example sentences drawn from the Spanish Wikipedia corpus:
58
+
59
+ > Apogonia es un género de escarabajos. Algunos son plagas de los árboles de durio. Referencias
60
+
61
+ > Elymordeum es un género monotípico de plantas herbáceas perteneciente a la familia de las poáceas. Su única especie es Elymordeum montanense (Scribn.) Bowden. Referencias
62
+
63
+ > Graphis es un género de hongos liquenizados de la familia Graphidaceae. Fue descrito por el naturalista francés Michel Adanson en Referencias de Graphidales
64
+
65
+ > Modem puede hacer referencia: el módem, dispositivo electrónico de comunicación; o el partido político francés MoDem.
66
+
67
+ > Opegrapha es un género de hongos liquenizados de la familia Opegraphaceae. Especies Referencias de Arthoniales
68
+
69
+ ## Quick Start
70
+
71
+ ### Load the Tokenizer
72
+
73
+ ```python
74
+ import sentencepiece as spm
75
+
76
+ sp = spm.SentencePieceProcessor()
77
+ sp.Load("es_tokenizer_32k.model")
78
+
79
+ text = "Opegrapha es un género de hongos liquenizados de la familia Opegraphaceae. Espec"
80
+ tokens = sp.EncodeAsPieces(text)
81
+ ids = sp.EncodeAsIds(text)
82
+
83
+ print(tokens) # subword pieces
84
+ print(ids) # integer ids
85
+
86
+ # Decode back
87
+ print(sp.DecodeIds(ids))
88
+ ```
89
+
90
+ <details>
91
+ <summary><b>Tokenization examples (click to expand)</b></summary>
92
+
93
+ **Sample 1:** `Opegrapha es un género de hongos liquenizados de la familia Opegraphaceae. Espec…`
94
+
95
+ | Vocab | Tokens | Count |
96
+ |-------|--------|-------|
97
+ | 8k | `▁o pe gra p ha ▁es ▁un ▁género ▁de ▁hon … (+22 more)` | 32 |
98
+ | 16k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li … (+18 more)` | 28 |
99
+ | 32k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li … (+17 more)` | 27 |
100
+ | 64k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li … (+17 more)` | 27 |
101
+
102
+ **Sample 2:** `Una única familia: Salicaceae. Árboles, arbustos y matas. Numerosos óvulos; 2 ca…`
103
+
104
+ | Vocab | Tokens | Count |
105
+ |-------|--------|-------|
106
+ | 8k | `▁una ▁única ▁familia : ▁sal ica ceae . ▁árboles , … (+29 more)` | 39 |
107
+ | 16k | `▁una ▁única ▁familia : ▁sal ica ceae . ▁árboles , … (+24 more)` | 34 |
108
+ | 32k | `▁una ▁única ▁familia : ▁sal icaceae . ▁árboles , ▁arbustos … (+17 more)` | 27 |
109
+ | 64k | `▁una ▁única ▁familia : ▁sal icaceae . ▁árboles , ▁arbustos … (+17 more)` | 27 |
110
+
111
+ **Sample 3:** `Apogonia es un género de escarabajos. Algunos son plagas de los árboles de durio…`
112
+
113
+ | Vocab | Tokens | Count |
114
+ |-------|--------|-------|
115
+ | 8k | `▁apo gon ia ▁es ▁un ▁género ▁de ▁esca ra ba … (+14 more)` | 24 |
116
+ | 16k | `▁apo gon ia ▁es ▁un ▁género ▁de ▁esca raba jos … (+13 more)` | 23 |
117
+ | 32k | `▁apo gonia ▁es ▁un ▁género ▁de ▁esca raba jos . … (+12 more)` | 22 |
118
+ | 64k | `▁apo gonia ▁es ▁un ▁género ▁de ▁escarabajos . ▁algunos ▁son … (+9 more)` | 19 |
119
+
120
+ </details>
121
+
122
+ ### Load Word Embeddings
123
+
124
+ ```python
125
+ from gensim.models import KeyedVectors
126
+
127
+ # Aligned embeddings (cross-lingual, mapped to English vector space)
128
+ wv = KeyedVectors.load("es_embeddings_128d_aligned.kv")
129
+
130
+ similar = wv.most_similar("word", topn=5)
131
+ for word, score in similar:
132
+ print(f" {word}: {score:.3f}")
133
+ ```
134
+
135
+ ### Load N-gram Model
136
+
137
+ ```python
138
+ import pyarrow.parquet as pq
139
+
140
+ df = pq.read_table("es_3gram_word.parquet").to_pandas()
141
+ print(df.head())
142
+ ```
143
+
144
+ ## Models Overview
145
+
146
+ ![Performance Dashboard](visualizations/performance_dashboard.png)
147
+
148
+ | Category | Assets |
149
+ |----------|--------|
150
+ | Tokenizers | BPE at 8k, 16k, 32k, 64k vocab sizes |
151
+ | N-gram models | 2 / 3 / 4 / 5-gram (word & subword) |
152
+ | Markov chains | Context 1–5 (word & subword) |
153
+ | Embeddings | 32d, 64d, 128d — mono & aligned |
154
+ | Vocabulary | Full frequency list + Zipf analysis |
155
+ | Statistics | Corpus & model statistics JSON |
156
+
157
+ ## Metrics Summary
158
+
159
+ | Component | Model | Key Metric | Value |
160
+ |-----------|-------|------------|-------|
161
+ | Tokenizer | 8k BPE | Compression | 3.89x |
162
+ | Tokenizer | 16k BPE | Compression | 4.28x |
163
+ | Tokenizer | 32k BPE | Compression | 4.60x |
164
+ | Tokenizer | 64k BPE | Compression | 4.83x 🏆 |
165
+ | N-gram | 2-gram (subword) | Perplexity | 225 🏆 |
166
+ | N-gram | 2-gram (word) | Perplexity | 183,447 |
167
+ | N-gram | 3-gram (subword) | Perplexity | 1,802 |
168
+ | N-gram | 3-gram (word) | Perplexity | 1,817,727 |
169
+ | N-gram | 4-gram (subword) | Perplexity | 10,272 |
170
+ | N-gram | 4-gram (word) | Perplexity | 7,309,961 |
171
+ | N-gram | 5-gram (subword) | Perplexity | 43,696 |
172
+ | N-gram | 5-gram (word) | Perplexity | 8,151,138 |
173
+ | Markov | ctx-1 (subword) | Predictability | 0.0% |
174
+ | Markov | ctx-1 (word) | Predictability | 0.0% |
175
+ | Markov | ctx-2 (subword) | Predictability | 37.1% |
176
+ | Markov | ctx-2 (word) | Predictability | 53.8% |
177
+ | Markov | ctx-3 (subword) | Predictability | 32.1% |
178
+ | Markov | ctx-3 (word) | Predictability | 76.0% |
179
+ | Markov | ctx-4 (subword) | Predictability | 32.2% |
180
+ | Markov | ctx-4 (word) | Predictability | 88.3% 🏆 |
181
+ | Vocabulary | full | Size | 1,128,398 |
182
+ | Vocabulary | full | Zipf R² | 0.9938 |
183
+ | Embeddings | mono_32d | Isotropy | 0.7898 |
184
+ | Embeddings | mono_64d | Isotropy | 0.7625 |
185
+ | Embeddings | mono_128d | Isotropy | 0.6860 |
186
+ | Embeddings | aligned_32d | Isotropy | 0.7898 🏆 |
187
+ | Embeddings | aligned_64d | Isotropy | 0.7625 |
188
+ | Embeddings | aligned_128d | Isotropy | 0.6860 |
189
+ | Alignment | aligned_32d | R@1 / R@5 / R@10 | 56.6% / 81.2% / 86.8% |
190
+ | Alignment | aligned_64d | R@1 / R@5 / R@10 | 75.2% / 88.6% / 92.6% |
191
+ | Alignment | aligned_128d | R@1 / R@5 / R@10 | 79.6% / 94.4% / 96.8% 🏆 |
192
+
193
+ 📊 **[Full ablation study, per-model breakdowns, and interpretation guide →](RESEARCH_REPORT.md)**
194
+
195
+ ---
196
+
197
+ ## About
198
+
199
+ Trained on [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) — monthly snapshots of 300+ Wikipedia languages.
200
+
201
+ A project by **[Wikilangs](https://wikilangs.org)** · Maintainer: [Omar Kamali](https://omarkamali.com) · [Omneity Labs](https://omneitylabs.com)
202
+
203
+ ### Citation
204
+
205
+ ```bibtex
206
+ @misc{wikilangs2025,
207
+ author = {Kamali, Omar},
208
+ title = {Wikilangs: Open NLP Models for Wikipedia Languages},
209
+ year = {2025},
210
+ doi = {10.5281/zenodo.18073153},
211
+ publisher = {Zenodo},
212
+ url = {https://huggingface.co/wikilangs},
213
+ institution = {Omneity Labs}
214
+ }
215
+ ```
216
+
217
+ ### Links
218
+
219
+ - 🌐 [wikilangs.org](https://wikilangs.org)
220
+ - 🌍 [Language page](https://wikilangs.org/languages/es/)
221
+ - 🎮 [Playground](https://wikilangs.org/playground/?lang=es)
222
+ - 🤗 [HuggingFace models](https://huggingface.co/wikilangs)
223
+ - 📊 [wikipedia-monthly dataset](https://huggingface.co/datasets/omarkamali/wikipedia-monthly)
224
+ - 👤 [Omar Kamali](https://huggingface.co/omarkamali)
225
+ - 🤝 Sponsor: [Featherless AI](https://featherless.ai)
226
+
227
+ **License:** MIT — free for academic and commercial use.
228
+
229
+ ---
230
+ *Generated by Wikilangs Pipeline · 2026-03-04 04:26:07*
RESEARCH_REPORT.md ADDED
@@ -0,0 +1,686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Spanish — Full Ablation Study & Research Report
2
+
3
+ Detailed evaluation of all model variants trained on **Spanish** Wikipedia data by [Wikilangs](https://wikilangs.org).
4
+
5
+ 👈 [Back to README](README.md)
6
+
7
+ ## 📋 Repository Contents
8
+
9
+ ### Models & Assets
10
+
11
+ - Tokenizers (8k, 16k, 32k, 64k)
12
+ - N-gram models (2, 3, 4, 5-gram)
13
+ - Markov chains (context of 1, 2, 3, 4 and 5)
14
+ - Subword N-gram and Markov chains
15
+ - Embeddings in various sizes and dimensions (aligned and unaligned)
16
+ - Language Vocabulary
17
+ - Language Statistics
18
+
19
+ ![Performance Dashboard](visualizations/performance_dashboard.png)
20
+
21
+ ### Analysis and Evaluation
22
+
23
+ - [1. Tokenizer Evaluation](#1-tokenizer-evaluation)
24
+ - [2. N-gram Model Evaluation](#2-n-gram-model-evaluation)
25
+ - [3. Markov Chain Evaluation](#3-markov-chain-evaluation)
26
+ - [4. Vocabulary Analysis](#4-vocabulary-analysis)
27
+ - [5. Word Embeddings Evaluation](#5-word-embeddings-evaluation)
28
+ - [6. Morphological Analysis (Experimental)](#6--morphological-analysis-experimental)
29
+ - [7. Summary & Recommendations](#7-summary--recommendations)
30
+ - [Metrics Glossary](#appendix-metrics-glossary--interpretation-guide)
31
+ - [Visualizations Index](#visualizations-index)
32
+
33
+ ---
34
+ ## 1. Tokenizer Evaluation
35
+
36
+ ![Tokenizer Compression](visualizations/tokenizer_compression.png)
37
+
38
+ ![Tokenizer Fertility](visualizations/tokenizer_fertility.png)
39
+
40
+ ![Tokenizer OOV](visualizations/tokenizer_oov.png)
41
+
42
+ ![Total Tokens](visualizations/tokenizer_total_tokens.png)
43
+
44
+ ### Results
45
+
46
+ | Vocab Size | Compression | Avg Token Len | UNK Rate | Total Tokens |
47
+ |------------|-------------|---------------|----------|--------------|
48
+ | **8k** | 3.885x | 3.89 | 0.0687% | 4,882,549 |
49
+ | **16k** | 4.280x | 4.28 | 0.0756% | 4,432,264 |
50
+ | **32k** | 4.603x | 4.60 | 0.0813% | 4,121,359 |
51
+ | **64k** | 4.831x 🏆 | 4.83 | 0.0854% | 3,926,906 |
52
+
53
+ ### Tokenization Examples
54
+
55
+ Below are sample sentences tokenized with each vocabulary size:
56
+
57
+ **Sample 1:** `Opegrapha es un género de hongos liquenizados de la familia Opegraphaceae. Espec...`
58
+
59
+ | Vocab | Tokens | Count |
60
+ |-------|--------|-------|
61
+ | 8k | `▁o pe gra p ha ▁es ▁un ▁género ▁de ▁hon ... (+22 more)` | 32 |
62
+ | 16k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li ... (+18 more)` | 28 |
63
+ | 32k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li ... (+17 more)` | 27 |
64
+ | 64k | `▁o pe gra pha ▁es ▁un ▁género ▁de ▁hongos ▁li ... (+17 more)` | 27 |
65
+
66
+ **Sample 2:** `Una única familia: Salicaceae. Árboles, arbustos y matas. Numerosos óvulos; 2 ca...`
67
+
68
+ | Vocab | Tokens | Count |
69
+ |-------|--------|-------|
70
+ | 8k | `▁una ▁única ▁familia : ▁sal ica ceae . ▁árboles , ... (+29 more)` | 39 |
71
+ | 16k | `▁una ▁única ▁familia : ▁sal ica ceae . ▁árboles , ... (+24 more)` | 34 |
72
+ | 32k | `▁una ▁única ▁familia : ▁sal icaceae . ▁árboles , ▁arbustos ... (+17 more)` | 27 |
73
+ | 64k | `▁una ▁única ▁familia : ▁sal icaceae . ▁árboles , ▁arbustos ... (+17 more)` | 27 |
74
+
75
+ **Sample 3:** `Apogonia es un género de escarabajos. Algunos son plagas de los árboles de durio...`
76
+
77
+ | Vocab | Tokens | Count |
78
+ |-------|--------|-------|
79
+ | 8k | `▁apo gon ia ▁es ▁un ▁género ▁de ▁esca ra ba ... (+14 more)` | 24 |
80
+ | 16k | `▁apo gon ia ▁es ▁un ▁género ▁de ▁esca raba jos ... (+13 more)` | 23 |
81
+ | 32k | `▁apo gonia ▁es ▁un ▁género ▁de ▁esca raba jos . ... (+12 more)` | 22 |
82
+ | 64k | `▁apo gonia ▁es ▁un ▁género ▁de ▁escarabajos . ▁algunos ▁son ... (+9 more)` | 19 |
83
+
84
+
85
+ ### Key Findings
86
+
87
+ - **Best Compression:** 64k achieves 4.831x compression
88
+ - **Lowest UNK Rate:** 8k with 0.0687% unknown tokens
89
+ - **Trade-off:** Larger vocabularies improve compression but increase model size
90
+ - **Recommendation:** 32k vocabulary provides optimal balance for production use
91
+
92
+ ---
93
+ ## 2. N-gram Model Evaluation
94
+
95
+ ![N-gram Perplexity](visualizations/ngram_perplexity.png)
96
+
97
+ ![N-gram Unique](visualizations/ngram_unique.png)
98
+
99
+ ![N-gram Coverage](visualizations/ngram_coverage.png)
100
+
101
+ ### Results
102
+
103
+ | N-gram | Variant | Perplexity | Entropy | Unique N-grams | Top-100 Coverage | Top-1000 Coverage |
104
+ |--------|---------|------------|---------|----------------|------------------|-------------------|
105
+ | **2-gram** | Word | 183,447 | 17.49 | 4,181,700 | 10.2% | 22.2% |
106
+ | **2-gram** | Subword | 225 🏆 | 7.82 | 32,676 | 73.3% | 99.3% |
107
+ | **3-gram** | Word | 1,817,727 | 20.79 | 12,295,310 | 2.4% | 7.7% |
108
+ | **3-gram** | Subword | 1,802 | 10.82 | 237,444 | 31.5% | 76.4% |
109
+ | **4-gram** | Word | 7,309,961 | 22.80 | 24,272,836 | 1.0% | 3.5% |
110
+ | **4-gram** | Subword | 10,272 | 13.33 | 1,392,210 | 16.3% | 43.2% |
111
+ | **5-gram** | Word | 8,151,138 | 22.96 | 17,610,926 | 0.6% | 2.4% |
112
+ | **5-gram** | Subword | 43,696 | 15.42 | 4,988,047 | 9.3% | 26.6% |
113
+
114
+ ### Top 5 N-grams by Size
115
+
116
+ **2-grams (Word):**
117
+
118
+ | Rank | N-gram | Count |
119
+ |------|--------|-------|
120
+ | 1 | `de la` | 3,764,844 |
121
+ | 2 | `en el` | 1,831,679 |
122
+ | 3 | `en la` | 1,685,738 |
123
+ | 4 | `de los` | 1,321,114 |
124
+ | 5 | `a la` | 938,285 |
125
+
126
+ **3-grams (Word):**
127
+
128
+ | Rank | N-gram | Count |
129
+ |------|--------|-------|
130
+ | 1 | `uno de los` | 141,403 |
131
+ | 2 | `de la ciudad` | 115,570 |
132
+ | 3 | `la ciudad de` | 108,727 |
133
+ | 4 | `referencias enlaces externos` | 100,698 |
134
+ | 5 | `la provincia de` | 97,604 |
135
+
136
+ **4-grams (Word):**
137
+
138
+ | Rank | N-gram | Count |
139
+ |------|--------|-------|
140
+ | 1 | `de la provincia de` | 59,022 |
141
+ | 2 | `de la ciudad de` | 41,783 |
142
+ | 3 | `a lo largo de` | 38,783 |
143
+ | 4 | `de la universidad de` | 33,450 |
144
+ | 5 | `en la ciudad de` | 31,628 |
145
+
146
+ **5-grams (Word):**
147
+
148
+ | Rank | N-gram | Count |
149
+ |------|--------|-------|
150
+ | 1 | `a lo largo de la` | 12,052 |
151
+ | 2 | `cuenta con una población de` | 11,005 |
152
+ | 3 | `0 0 0 0 0` | 10,612 |
153
+ | 4 | `en los juegos olímpicos de` | 8,927 |
154
+ | 5 | `de la segunda guerra mundial` | 8,768 |
155
+
156
+ **2-grams (Subword):**
157
+
158
+ | Rank | N-gram | Count |
159
+ |------|--------|-------|
160
+ | 1 | `e _` | 52,737,608 |
161
+ | 2 | `a _` | 52,540,713 |
162
+ | 3 | `_ d` | 41,585,544 |
163
+ | 4 | `d e` | 41,490,874 |
164
+ | 5 | `s _` | 40,981,306 |
165
+
166
+ **3-grams (Subword):**
167
+
168
+ | Rank | N-gram | Count |
169
+ |------|--------|-------|
170
+ | 1 | `_ d e` | 34,910,171 |
171
+ | 2 | `d e _` | 27,000,114 |
172
+ | 3 | `_ l a` | 16,444,469 |
173
+ | 4 | `o s _` | 15,082,263 |
174
+ | 5 | `e l _` | 14,921,174 |
175
+
176
+ **4-grams (Subword):**
177
+
178
+ | Rank | N-gram | Count |
179
+ |------|--------|-------|
180
+ | 1 | `_ d e _` | 25,355,198 |
181
+ | 2 | `_ l a _` | 12,685,143 |
182
+ | 3 | `_ e n _` | 10,248,634 |
183
+ | 4 | `_ e l _` | 9,367,910 |
184
+ | 5 | `o _ d e` | 6,941,874 |
185
+
186
+ **5-grams (Subword):**
187
+
188
+ | Rank | N-gram | Count |
189
+ |------|--------|-------|
190
+ | 1 | `_ d e _ l` | 6,404,305 |
191
+ | 2 | `o _ d e _` | 5,587,851 |
192
+ | 3 | `s _ d e _` | 5,212,347 |
193
+ | 4 | `_ q u e _` | 5,016,845 |
194
+ | 5 | `d e _ l a` | 4,732,721 |
195
+
196
+
197
+ ### Key Findings
198
+
199
+ - **Best Perplexity:** 2-gram (subword) with 225
200
+ - **Entropy Trend:** Decreases with larger n-grams (more predictable)
201
+ - **Coverage:** Top-1000 patterns cover ~27% of corpus
202
+ - **Recommendation:** 4-gram or 5-gram for best predictive performance
203
+
204
+ ---
205
+ ## 3. Markov Chain Evaluation
206
+
207
+ ![Markov Entropy](visualizations/markov_entropy.png)
208
+
209
+ ![Markov Contexts](visualizations/markov_contexts.png)
210
+
211
+ ![Markov Branching](visualizations/markov_branching.png)
212
+
213
+ ### Results
214
+
215
+ | Context | Variant | Avg Entropy | Perplexity | Branching Factor | Unique Contexts | Predictability |
216
+ |---------|---------|-------------|------------|------------------|-----------------|----------------|
217
+ | **1** | Word | 1.0184 | 2.026 | 16.60 | 2,511,755 | 0.0% |
218
+ | **1** | Subword | 1.1686 | 2.248 | 8.74 | 17,433 | 0.0% |
219
+ | **2** | Word | 0.4618 | 1.377 | 3.10 | 41,654,830 | 53.8% |
220
+ | **2** | Subword | 0.6288 | 1.546 | 4.11 | 152,257 | 37.1% |
221
+ | **3** | Word | 0.2403 | 1.181 | 1.67 | 128,974,391 | 76.0% |
222
+ | **3** | Subword | 0.6792 | 1.601 | 4.08 | 625,267 | 32.1% |
223
+ | **4** | Word | 0.1170 🏆 | 1.084 | 1.24 | 214,851,229 | 88.3% |
224
+ | **4** | Subword | 0.6781 | 1.600 | 3.60 | 2,547,890 | 32.2% |
225
+
226
+ ### Generated Text Samples (Word-based)
227
+
228
+ Below are text samples generated from each word-based Markov chain model:
229
+
230
+ **Context Size 1:**
231
+
232
+ 1. `de boca juniors al alcanzar sus danzas en el nk con ellos el español y el`
233
+ 2. `la ribera de jabez aúl en el primer álbum considerada una variante guacara data del encéfalo`
234
+ 3. `en la pequeña localidad recibió una especie musa valí de megaron del origen suizo enfrentar demandas`
235
+
236
+ **Context Size 2:**
237
+
238
+ 1. `de la campana de huesca por el proyecto de igual manera considera a los que la rebelión`
239
+ 2. `en el reino humano ahí habitaban las estribaciones de la flota de la presidencia de manuel fernández`
240
+ 3. `en la victoria del ejército mexicano las investigaciones arqueológicas fue también del talmud en el ...`
241
+
242
+ **Context Size 3:**
243
+
244
+ 1. `uno de los testimonios más antiguos independientes de eugène canseliet y tomados exclusivamente de f...`
245
+ 2. `de la ciudad donde el cadáver yacía aún en el aeropuerto recibió a 4 120 000 de los`
246
+ 3. `la ciudad de bogotá ya que también fue considerado para ser desarrollado como una expresión profunda...`
247
+
248
+ **Context Size 4:**
249
+
250
+ 1. `de la provincia de buenos aires de argentina de bienestar social de mallorca cirer toma posesión del...`
251
+ 2. `de la ciudad de méxico y dentro de la esfera de las tradiciones judías con elementos de culto judío`
252
+ 3. `a lo largo de la jornada feria barroca a primeros de octubre embarcaron rumbo a la desierta isla de`
253
+
254
+
255
+ ### Generated Text Samples (Subword-based)
256
+
257
+ Below are text samples generated from each subword-based Markov chain model:
258
+
259
+ **Context Size 1:**
260
+
261
+ 1. `_uien_y_sene_fuá`
262
+ 2. `e_locipa_y_tatr_`
263
+ 3. `atrs_a_playblay_`
264
+
265
+ **Context Size 2:**
266
+
267
+ 1. `e_con_utien_dity,`
268
+ 2. `a_a_ta_y_carro_el`
269
+ 3. `_de_tes_perona_pr`
270
+
271
+ **Context Size 3:**
272
+
273
+ 1. `_de_un_mar_más_all`
274
+ 2. `de_la_bra_con_el_,`
275
+ 3. `_la_la_conte,_g._c`
276
+
277
+ **Context Size 4:**
278
+
279
+ 1. `_de_la_justaventas_`
280
+ 2. `_la_interés_pequeta`
281
+ 3. `_en_varie_daño_a_la`
282
+
283
+
284
+ ### Key Findings
285
+
286
+ - **Best Predictability:** Context-4 (word) with 88.3% predictability
287
+ - **Branching Factor:** Decreases with context size (more deterministic)
288
+ - **Memory Trade-off:** Larger contexts require more storage (2,547,890 contexts)
289
+ - **Recommendation:** Context-3 or Context-4 for text generation
290
+
291
+ ---
292
+ ## 4. Vocabulary Analysis
293
+
294
+ ![Zipf's Law](visualizations/zipf_law.png)
295
+
296
+ ![Top Words](visualizations/top20_words.png)
297
+
298
+ ![Coverage Curve](visualizations/vocab_coverage.png)
299
+
300
+ ### Statistics
301
+
302
+ | Metric | Value |
303
+ |--------|-------|
304
+ | Vocabulary Size | 1,128,398 |
305
+ | Total Tokens | 317,857,480 |
306
+ | Mean Frequency | 281.69 |
307
+ | Median Frequency | 4 |
308
+ | Frequency Std Dev | 33492.75 |
309
+
310
+ ### Most Common Words
311
+
312
+ | Rank | Word | Frequency |
313
+ |------|------|-----------|
314
+ | 1 | de | 25,424,319 |
315
+ | 2 | la | 12,852,916 |
316
+ | 3 | en | 10,451,863 |
317
+ | 4 | el | 9,561,089 |
318
+ | 5 | y | 8,147,125 |
319
+ | 6 | a | 5,543,222 |
320
+ | 7 | que | 5,130,281 |
321
+ | 8 | del | 4,632,587 |
322
+ | 9 | los | 4,528,979 |
323
+ | 10 | se | 3,615,320 |
324
+
325
+ ### Least Common Words (from vocabulary)
326
+
327
+ | Rank | Word | Frequency |
328
+ |------|------|-----------|
329
+ | 1 | drammenselva | 2 |
330
+ | 2 | bidagos | 2 |
331
+ | 3 | guillenpbro | 2 |
332
+ | 4 | peytrequincomisión | 2 |
333
+ | 5 | méndezpbro | 2 |
334
+ | 6 | ollerhno | 2 |
335
+ | 7 | ricamonseñor | 2 |
336
+ | 8 | grezillé | 2 |
337
+ | 9 | leguedeniau | 2 |
338
+ | 10 | lajubaudiere | 2 |
339
+
340
+ ### Zipf's Law Analysis
341
+
342
+ | Metric | Value |
343
+ |--------|-------|
344
+ | Zipf Coefficient | 0.9940 |
345
+ | R² (Goodness of Fit) | 0.993771 |
346
+ | Adherence Quality | **excellent** |
347
+
348
+ ### Coverage Analysis
349
+
350
+ | Top N Words | Coverage |
351
+ |-------------|----------|
352
+ | Top 100 | 44.4% |
353
+ | Top 1,000 | 62.8% |
354
+ | Top 5,000 | 78.2% |
355
+ | Top 10,000 | 84.3% |
356
+
357
+ ### Key Findings
358
+
359
+ - **Zipf Compliance:** R²=0.9938 indicates excellent adherence to Zipf's law
360
+ - **High Frequency Dominance:** Top 100 words cover 44.4% of corpus
361
+ - **Long Tail:** 1,118,398 words needed for remaining 15.7% coverage
362
+
363
+ ---
364
+ ## 5. Word Embeddings Evaluation
365
+
366
+ ![Embedding Isotropy](visualizations/embedding_isotropy.png)
367
+
368
+ ![Similarity Matrix](visualizations/embedding_similarity.png)
369
+
370
+ ![t-SNE Words](visualizations/tsne_words.png)
371
+
372
+ ![t-SNE Sentences](visualizations/tsne_sentences.png)
373
+
374
+
375
+ ### 5.1 Cross-Lingual Alignment
376
+
377
+ ![Alignment Quality](visualizations/embedding_alignment_quality.png)
378
+
379
+ ![Multilingual t-SNE](visualizations/embedding_tsne_multilingual.png)
380
+
381
+
382
+ ### 5.2 Model Comparison
383
+
384
+ | Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 |
385
+ |-------|-----------|----------|------------------|---------------|----------------|
386
+ | **mono_32d** | 32 | 0.7898 | 0.3869 | N/A | N/A |
387
+ | **mono_64d** | 64 | 0.7625 | 0.3145 | N/A | N/A |
388
+ | **mono_128d** | 128 | 0.6860 | 0.2555 | N/A | N/A |
389
+ | **aligned_32d** | 32 | 0.7898 🏆 | 0.3861 | 0.5660 | 0.8680 |
390
+ | **aligned_64d** | 64 | 0.7625 | 0.3206 | 0.7520 | 0.9260 |
391
+ | **aligned_128d** | 128 | 0.6860 | 0.2619 | 0.7960 | 0.9680 |
392
+
393
+ ### Key Findings
394
+
395
+ - **Best Isotropy:** aligned_32d with 0.7898 (more uniform distribution)
396
+ - **Semantic Density:** Average pairwise similarity of 0.3209. Lower values indicate better semantic separation.
397
+ - **Alignment Quality:** Aligned models achieve up to 79.6% R@1 in cross-lingual retrieval.
398
+ - **Recommendation:** 128d aligned for best cross-lingual performance
399
+
400
+ ---
401
+ ## 6. Morphological Analysis (Experimental)
402
+
403
+ 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.
404
+
405
+ ### 6.1 Productivity & Complexity
406
+
407
+ | Metric | Value | Interpretation | Recommendation |
408
+ |--------|-------|----------------|----------------|
409
+ | Productivity Index | **5.000** | High morphological productivity | Reliable analysis |
410
+ | Idiomaticity Gap | **-0.909** | Low formulaic content | - |
411
+
412
+ ### 6.2 Affix Inventory (Productive Units)
413
+
414
+ 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.
415
+
416
+ #### Productive Prefixes
417
+ | Prefix | Examples |
418
+ |--------|----------|
419
+ | `-a` | aprile, akiya, argumenta |
420
+ | `-s` | seifer, seninho, stobar |
421
+ | `-ma` | maremmae, maozim, manks |
422
+ | `-m` | mizrajíes, moguereños, morganáticas |
423
+ | `-c` | captivos, coevolucionarias, clips |
424
+ | `-p` | pk3, polistinae, polypetalæ |
425
+ | `-t` | tangamanga, tedros, tubariales |
426
+ | `-b` | bundesagentur, bitschnau, botrioides |
427
+
428
+ #### Productive Suffixes
429
+ | Suffix | Examples |
430
+ |--------|----------|
431
+ | `-s` | lebbeus, tedros, captivos |
432
+ | `-a` | tangamanga, akiya, luvana |
433
+ | `-o` | kajanto, seninho, ducetio |
434
+ | `-e` | aprile, trimble, dumonde |
435
+ | `-n` | hazzan, ameln, bebieron |
436
+ | `-os` | tedros, captivos, moguereños |
437
+ | `-es` | tubariales, emboques, mizrajíes |
438
+ | `-as` | coevolucionarias, morganáticas, turillas |
439
+
440
+ ### 6.3 Bound Stems (Lexical Roots)
441
+
442
+ 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.
443
+
444
+ | Stem | Cohesion | Substitutability | Examples |
445
+ |------|----------|------------------|----------|
446
+ | `iend` | 1.89x | 259 contexts | iendo, fiend, liendo |
447
+ | `ient` | 1.55x | 383 contexts | aient, iente, cient |
448
+ | `spañ` | 2.35x | 44 contexts | españ, spaña, españa |
449
+ | `ació` | 1.84x | 114 contexts | ación, vació, yació |
450
+ | `lmen` | 1.79x | 97 contexts | ülmen, olmen, ilmen |
451
+ | `aliz` | 1.40x | 288 contexts | aliza, valiz, alizé |
452
+ | `ombr` | 1.52x | 179 contexts | ombri, sombr, ombre |
453
+ | `resi` | 1.36x | 299 contexts | resis, resid, resit |
454
+ | `stru` | 1.34x | 259 contexts | strub, strul, struk |
455
+ | `ontr` | 1.45x | 156 contexts | contr, pontro, lontra |
456
+ | `renc` | 1.40x | 185 contexts | prenc, renck, frenc |
457
+ | `ntre` | 1.41x | 176 contexts | antre, intre, entre |
458
+
459
+ ### 6.4 Affix Compatibility (Co-occurrence)
460
+
461
+ This table shows which prefixes and suffixes most frequently co-occur on the same stems, revealing the 'stacking' rules of the language's morphology.
462
+
463
+ | Prefix | Suffix | Frequency | Examples |
464
+ |--------|--------|-----------|----------|
465
+ | `-a` | `-s` | 162 words | arrianas, alumbrados |
466
+ | `-c` | `-s` | 149 words | certhiaxis, corpasinos |
467
+ | `-c` | `-a` | 139 words | contrarreforma, cusítica |
468
+ | `-p` | `-s` | 132 words | phitos, preformados |
469
+ | `-a` | `-a` | 118 words | azaña, artemisina |
470
+ | `-s` | `-s` | 116 words | subtropicalis, senderistas |
471
+ | `-p` | `-a` | 114 words | proteobacteria, prevalescencia |
472
+ | `-e` | `-s` | 111 words | estamos, escarpes |
473
+ | `-t` | `-s` | 94 words | tragaluces, thenailles |
474
+ | `-c` | `-o` | 88 words | cristofano, calpetano |
475
+
476
+ ### 6.5 Recursive Morpheme Segmentation
477
+
478
+ Using **Recursive Hierarchical Substitutability**, we decompose complex words into their constituent morphemes. This approach handles nested affixes (e.g., `prefix-prefix-root-suffix`).
479
+
480
+ | Word | Suggested Split | Confidence | Stem |
481
+ |------|-----------------|------------|------|
482
+ | desarrollarlas | **`desarrollar-la-s`** | 7.5 | `la` |
483
+ | peptoides | **`peptoi-d-es`** | 7.5 | `d` |
484
+ | şemsiruhsar | **`şemsiruh-s-ar`** | 7.5 | `s` |
485
+ | zakrisson | **`zakris-s-on`** | 7.5 | `s` |
486
+ | caesarobrigenses | **`caesarobrigen-s-es`** | 7.5 | `s` |
487
+ | kushiyara | **`kushiy-a-ra`** | 7.5 | `a` |
488
+ | ngwempisi | **`ngwempi-s-i`** | 7.5 | `s` |
489
+ | hēmitheos | **`hēmith-e-os`** | 7.5 | `e` |
490
+ | tsimliansk | **`tsimlian-s-k`** | 7.5 | `s` |
491
+ | inculcado | **`inculc-a-do`** | 7.5 | `a` |
492
+ | cbgranada | **`cbgran-a-da`** | 7.5 | `a` |
493
+ | trespasser | **`trespas-s-er`** | 7.5 | `s` |
494
+ | megasares | **`megas-ar-es`** | 7.5 | `ar` |
495
+ | programarlas | **`programar-la-s`** | 7.5 | `la` |
496
+ | galactano | **`galac-ta-no`** | 7.5 | `ta` |
497
+
498
+ ### 6.6 Linguistic Interpretation
499
+
500
+ > **Automated Insight:**
501
+ The language Spanish shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding.
502
+
503
+ ---
504
+ ## 7. Summary & Recommendations
505
+
506
+ ![Performance Dashboard](visualizations/performance_dashboard.png)
507
+
508
+ ### Production Recommendations
509
+
510
+ | Component | Recommended | Rationale |
511
+ |-----------|-------------|-----------|
512
+ | Tokenizer | **64k BPE** | Best compression (4.83x) |
513
+ | N-gram | **2-gram** | Lowest perplexity (225) |
514
+ | Markov | **Context-4** | Highest predictability (88.3%) |
515
+ | Embeddings | **100d** | Balanced semantic capture and isotropy |
516
+
517
+
518
+ ---
519
+ ## Appendix: Metrics Glossary & Interpretation Guide
520
+
521
+ This section provides definitions, intuitions, and guidance for interpreting the metrics used throughout this report.
522
+
523
+ ### Tokenizer Metrics
524
+
525
+ **Compression Ratio**
526
+ > *Definition:* The ratio of characters to tokens (chars/token). Measures how efficiently the tokenizer represents text.
527
+ >
528
+ > *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.
529
+ >
530
+ > *What to seek:* Higher is generally better for efficiency, but extremely high compression may indicate overly aggressive merging that loses morphological information.
531
+
532
+ **Average Token Length (Fertility)**
533
+ > *Definition:* Mean number of characters per token produced by the tokenizer.
534
+ >
535
+ > *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.
536
+ >
537
+ > *What to seek:* Balance between 2-5 characters for most languages. Arabic/morphologically-rich languages may benefit from slightly longer tokens.
538
+
539
+ **Unknown Token Rate (OOV Rate)**
540
+ > *Definition:* Percentage of tokens that map to the unknown/UNK token, indicating words the tokenizer cannot represent.
541
+ >
542
+ > *Intuition:* Lower OOV means better vocabulary coverage. High OOV indicates the tokenizer encounters many unseen character sequences.
543
+ >
544
+ > *What to seek:* Below 1% is excellent; below 5% is acceptable. BPE tokenizers typically achieve very low OOV due to subword fallback.
545
+
546
+ ### N-gram Model Metrics
547
+
548
+ **Perplexity**
549
+ > *Definition:* Measures how "surprised" the model is by test data. Mathematically: 2^(cross-entropy). Lower values indicate better prediction.
550
+ >
551
+ > *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.
552
+ >
553
+ > *What to seek:* Lower is better. Perplexity decreases with larger n-grams (more context). Values vary widely by language and corpus size.
554
+
555
+ **Entropy**
556
+ > *Definition:* Average information content (in bits) needed to encode the next token given the context. Related to perplexity: perplexity = 2^entropy.
557
+ >
558
+ > *Intuition:* High entropy means high uncertainty/randomness; low entropy means predictable patterns. Natural language typically has entropy between 1-4 bits per character.
559
+ >
560
+ > *What to seek:* Lower entropy indicates more predictable text patterns. Entropy should decrease as n-gram size increases.
561
+
562
+ **Coverage (Top-K)**
563
+ > *Definition:* Percentage of corpus occurrences explained by the top K most frequent n-grams.
564
+ >
565
+ > *Intuition:* High coverage with few patterns indicates repetitive/formulaic text; low coverage suggests diverse vocabulary usage.
566
+ >
567
+ > *What to seek:* Depends on use case. For language modeling, moderate coverage (40-60% with top-1000) is typical for natural text.
568
+
569
+ ### Markov Chain Metrics
570
+
571
+ **Average Entropy**
572
+ > *Definition:* Mean entropy across all contexts, measuring average uncertainty in next-word prediction.
573
+ >
574
+ > *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).
575
+ >
576
+ > *What to seek:* Decreasing entropy with larger context sizes. Very low entropy (<0.1) indicates highly deterministic transitions.
577
+
578
+ **Branching Factor**
579
+ > *Definition:* Average number of unique next tokens observed for each context.
580
+ >
581
+ > *Intuition:* High branching = many possible continuations (flexible but uncertain); low branching = few options (predictable but potentially repetitive).
582
+ >
583
+ > *What to seek:* Branching factor should decrease with context size. Values near 1.0 indicate nearly deterministic chains.
584
+
585
+ **Predictability**
586
+ > *Definition:* Derived metric: (1 - normalized_entropy) × 100%. Indicates how deterministic the model's predictions are.
587
+ >
588
+ > *Intuition:* 100% predictability means the next word is always certain; 0% means completely random. Real text falls between these extremes.
589
+ >
590
+ > *What to seek:* Higher predictability for text generation quality, but too high (>98%) may produce repetitive output.
591
+
592
+ ### Vocabulary & Zipf's Law Metrics
593
+
594
+ **Zipf's Coefficient**
595
+ > *Definition:* The slope of the log-log plot of word frequency vs. rank. Zipf's law predicts this should be approximately -1.
596
+ >
597
+ > *Intuition:* A coefficient near -1 indicates the corpus follows natural language patterns where a few words are very common and most words are rare.
598
+ >
599
+ > *What to seek:* Values between -0.8 and -1.2 indicate healthy natural language distribution. Deviations may suggest domain-specific or artificial text.
600
+
601
+ **R² (Coefficient of Determination)**
602
+ > *Definition:* Measures how well the linear fit explains the frequency-rank relationship. Ranges from 0 to 1.
603
+ >
604
+ > *Intuition:* R² near 1.0 means the data closely follows Zipf's law; lower values indicate deviation from expected word frequency patterns.
605
+ >
606
+ > *What to seek:* R² > 0.95 is excellent; > 0.99 indicates near-perfect Zipf adherence typical of large natural corpora.
607
+
608
+ **Vocabulary Coverage**
609
+ > *Definition:* Cumulative percentage of corpus tokens accounted for by the top N words.
610
+ >
611
+ > *Intuition:* Shows how concentrated word usage is. If top-100 words cover 50% of text, the corpus relies heavily on common words.
612
+ >
613
+ > *What to seek:* Top-100 covering 30-50% is typical. Higher coverage indicates more repetitive text; lower suggests richer vocabulary.
614
+
615
+ ### Word Embedding Metrics
616
+
617
+ **Isotropy**
618
+ > *Definition:* Measures how uniformly distributed vectors are in the embedding space. Computed as the ratio of minimum to maximum singular values.
619
+ >
620
+ > *Intuition:* High isotropy (near 1.0) means vectors spread evenly in all directions; low isotropy means vectors cluster in certain directions, reducing expressiveness.
621
+ >
622
+ > *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.
623
+
624
+ **Average Norm**
625
+ > *Definition:* Mean magnitude (L2 norm) of word vectors in the embedding space.
626
+ >
627
+ > *Intuition:* Indicates the typical "length" of vectors. Consistent norms suggest stable training; high variance may indicate some words are undertrained.
628
+ >
629
+ > *What to seek:* Relatively consistent norms across models. The absolute value matters less than consistency (low std deviation).
630
+
631
+ **Cosine Similarity**
632
+ > *Definition:* Measures angular similarity between vectors, ranging from -1 (opposite) to 1 (identical direction).
633
+ >
634
+ > *Intuition:* Words with similar meanings should have high cosine similarity. This is the standard metric for semantic relatedness in embeddings.
635
+ >
636
+ > *What to seek:* Semantically related words should score > 0.5; unrelated words should be near 0. Synonyms often score > 0.7.
637
+
638
+ **t-SNE Visualization**
639
+ > *Definition:* t-Distributed Stochastic Neighbor Embedding - a dimensionality reduction technique that preserves local structure for visualization.
640
+ >
641
+ > *Intuition:* Clusters in t-SNE plots indicate groups of semantically related words. Spread indicates vocabulary diversity; tight clusters suggest semantic coherence.
642
+ >
643
+ > *What to seek:* Meaningful clusters (e.g., numbers together, verbs together). Avoid over-interpreting distances - t-SNE preserves local, not global, structure.
644
+
645
+ ### General Interpretation Guidelines
646
+
647
+ 1. **Compare within model families:** Metrics are most meaningful when comparing models of the same type (e.g., 8k vs 64k tokenizer).
648
+ 2. **Consider trade-offs:** Better performance on one metric often comes at the cost of another (e.g., compression vs. OOV rate).
649
+ 3. **Context matters:** Optimal values depend on downstream tasks. Text generation may prioritize different metrics than classification.
650
+ 4. **Corpus influence:** All metrics are influenced by corpus characteristics. Wikipedia text differs from social media or literature.
651
+ 5. **Language-specific patterns:** Morphologically rich languages (like Arabic) may show different optimal ranges than analytic languages.
652
+
653
+
654
+ ### Visualizations Index
655
+
656
+ | Visualization | Description |
657
+ |---------------|-------------|
658
+ | Tokenizer Compression | Compression ratios by vocabulary size |
659
+ | Tokenizer Fertility | Average token length by vocabulary |
660
+ | Tokenizer OOV | Unknown token rates |
661
+ | Tokenizer Total Tokens | Total tokens by vocabulary |
662
+ | N-gram Perplexity | Perplexity by n-gram size |
663
+ | N-gram Entropy | Entropy by n-gram size |
664
+ | N-gram Coverage | Top pattern coverage |
665
+ | N-gram Unique | Unique n-gram counts |
666
+ | Markov Entropy | Entropy by context size |
667
+ | Markov Branching | Branching factor by context |
668
+ | Markov Contexts | Unique context counts |
669
+ | Zipf's Law | Frequency-rank distribution with fit |
670
+ | Vocab Frequency | Word frequency distribution |
671
+ | Top 20 Words | Most frequent words |
672
+ | Vocab Coverage | Cumulative coverage curve |
673
+ | Embedding Isotropy | Vector space uniformity |
674
+ | Embedding Norms | Vector magnitude distribution |
675
+ | Embedding Similarity | Word similarity heatmap |
676
+ | Nearest Neighbors | Similar words for key terms |
677
+ | t-SNE Words | 2D word embedding visualization |
678
+ | t-SNE Sentences | 2D sentence embedding visualization |
679
+ | Position Encoding | Encoding method comparison |
680
+ | Model Sizes | Storage requirements |
681
+ | Performance Dashboard | Comprehensive performance overview |
682
+
683
+ ---
684
+ 👈 [Back to README](README.md)
685
+
686
+ *Generated by Wikilangs Pipeline · 2026-03-04 06:09:07*
es_morph_tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
models/embeddings/aligned/es_128d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c394bd9656e921c77317177ba07d621cf0395a7be7a98ab7b3351639ce348f1
3
+ size 2212364627
models/embeddings/aligned/es_128d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 128, "max_seq_len": 512, "is_aligned": true}
models/embeddings/aligned/es_128d.projection.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:912b2c083e78cf88a216c46df638bee42daa2c71cc79f8b89e6a2200ca06c9f7
3
+ size 65664
models/embeddings/aligned/es_128d_metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 128,
4
+ "version": "aligned",
5
+ "hub_language": "en",
6
+ "seed_vocab_size": 301607,
7
+ "vocab_size": 1139960
8
+ }
models/embeddings/aligned/es_32d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1d3e1e8033a0e7d6d7cf6c87f8a56993391323504802d84461bba2db866da4f
3
+ size 568875347
models/embeddings/aligned/es_32d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 32, "max_seq_len": 512, "is_aligned": true}
models/embeddings/aligned/es_32d.projection.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f834e65da8f6293822fa013486578b904804c0a2ba09c8eb2530e81456b1f2b4
3
+ size 4224
models/embeddings/aligned/es_32d_metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 32,
4
+ "version": "aligned",
5
+ "hub_language": "en",
6
+ "seed_vocab_size": 301607,
7
+ "vocab_size": 1139960
8
+ }
models/embeddings/aligned/es_64d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c909f9f90fcc1a3cabb5b78725691bdd1a25f2245cc7890247947440a00e278
3
+ size 1116705107
models/embeddings/aligned/es_64d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 64, "max_seq_len": 512, "is_aligned": true}
models/embeddings/aligned/es_64d.projection.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8f6854e8ed1e41fad5d62cbf4f5d171dc28aac00fd19ccc17a9b6dd6f88dda9
3
+ size 16512
models/embeddings/aligned/es_64d_metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 64,
4
+ "version": "aligned",
5
+ "hub_language": "en",
6
+ "seed_vocab_size": 301607,
7
+ "vocab_size": 1139960
8
+ }
models/embeddings/monolingual/es_128d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c394bd9656e921c77317177ba07d621cf0395a7be7a98ab7b3351639ce348f1
3
+ size 2212364627
models/embeddings/monolingual/es_128d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 128, "max_seq_len": 512, "is_aligned": false}
models/embeddings/monolingual/es_128d_metadata.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 128,
4
+ "version": "monolingual",
5
+ "training_params": {
6
+ "algorithm": "skipgram",
7
+ "min_count": 5,
8
+ "window": 5,
9
+ "negative": 5,
10
+ "epochs": 5,
11
+ "encoding_method": "rope",
12
+ "dim": 128,
13
+ "threads": 40
14
+ },
15
+ "vocab_size": 1139960
16
+ }
models/embeddings/monolingual/es_32d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1d3e1e8033a0e7d6d7cf6c87f8a56993391323504802d84461bba2db866da4f
3
+ size 568875347
models/embeddings/monolingual/es_32d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 32, "max_seq_len": 512, "is_aligned": false}
models/embeddings/monolingual/es_32d_metadata.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 32,
4
+ "version": "monolingual",
5
+ "training_params": {
6
+ "algorithm": "skipgram",
7
+ "min_count": 5,
8
+ "window": 5,
9
+ "negative": 5,
10
+ "epochs": 5,
11
+ "encoding_method": "rope",
12
+ "dim": 32,
13
+ "threads": 40
14
+ },
15
+ "vocab_size": 1139960
16
+ }
models/embeddings/monolingual/es_64d.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c909f9f90fcc1a3cabb5b78725691bdd1a25f2245cc7890247947440a00e278
3
+ size 1116705107
models/embeddings/monolingual/es_64d.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lang": "es", "dim": 64, "max_seq_len": 512, "is_aligned": false}
models/embeddings/monolingual/es_64d_metadata.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "language": "es",
3
+ "dimension": 64,
4
+ "version": "monolingual",
5
+ "training_params": {
6
+ "algorithm": "skipgram",
7
+ "min_count": 5,
8
+ "window": 5,
9
+ "negative": 5,
10
+ "epochs": 5,
11
+ "encoding_method": "rope",
12
+ "dim": 64,
13
+ "threads": 40
14
+ },
15
+ "vocab_size": 1139960
16
+ }
models/subword_markov/es_markov_ctx1_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:469626b5287dce85b2a9e845bb1265778fb6ebd91a16c1c46949cf4aa99c79aa
3
+ size 983323
models/subword_markov/es_markov_ctx1_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "context_size": 1,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_contexts": 17433,
6
+ "total_transitions": 1951072483
7
+ }
models/subword_markov/es_markov_ctx2_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8eaab56f750e9f7e947c6b70adc837362e831d6740b718fa56e776db60962663
3
+ size 4960244
models/subword_markov/es_markov_ctx2_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "context_size": 2,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_contexts": 152257,
6
+ "total_transitions": 1950772483
7
+ }
models/subword_markov/es_markov_ctx3_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5a8e851d51fd2dc7b338fc5f71ab4431ee01b03b1cc3e5abac13d3d9b8b1f97
3
+ size 20208003
models/subword_markov/es_markov_ctx3_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "context_size": 3,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_contexts": 625267,
6
+ "total_transitions": 1950472483
7
+ }
models/subword_markov/es_markov_ctx4_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eee21709737b88ff808974a9bd39c3eb3966d440ef915819732237b2b6386407
3
+ size 72854924
models/subword_markov/es_markov_ctx4_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "context_size": 4,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_contexts": 2547890,
6
+ "total_transitions": 1950172483
7
+ }
models/subword_ngram/es_2gram_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08aede185d943cac0063c9a92c3a80d0f004abb56884152d1bb48fac631f6de4
3
+ size 450232
models/subword_ngram/es_2gram_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "n": 2,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_ngrams": 32676,
6
+ "total_ngrams": 1951072483
7
+ }
models/subword_ngram/es_3gram_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b4d5167bbf4d0fc9f49c67680b10de972c1ee76624fa033f5ae6605dfa776ef
3
+ size 2946172
models/subword_ngram/es_3gram_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "n": 3,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_ngrams": 237444,
6
+ "total_ngrams": 1950772483
7
+ }
models/subword_ngram/es_4gram_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4580ca427fdea679fa91e6387a8d040ba5c7ff085f55d0fd3301940a4f6fbfa
3
+ size 16985388
models/subword_ngram/es_4gram_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "n": 4,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_ngrams": 1392210,
6
+ "total_ngrams": 1950472483
7
+ }
models/subword_ngram/es_5gram_subword.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e06aa0fa2771c03f0445b7b90db540e6ce275caacd2d175b756a332be9a60a2
3
+ size 60318882
models/subword_ngram/es_5gram_subword_metadata.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "n": 5,
3
+ "variant": "subword",
4
+ "language": "es",
5
+ "unique_ngrams": 4988047,
6
+ "total_ngrams": 1950172483
7
+ }
models/tokenizer/es_tokenizer_16k.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d68f4ec974dee790a5e3275d1b162143bee3db1af3ab359a41688fdc80949bc6
3
+ size 517220
models/tokenizer/es_tokenizer_16k.vocab ADDED
The diff for this file is too large to render. See raw diff
 
models/tokenizer/es_tokenizer_32k.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74e08efaba41aaadc5d6a9403e85957122df61665f26d30b647e70193bcf67e5
3
+ size 803236
models/tokenizer/es_tokenizer_32k.vocab ADDED
The diff for this file is too large to render. See raw diff
 
models/tokenizer/es_tokenizer_64k.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88e563a38a64217815f007001e6e99afa665d9c07d5466445d417a5a942e0330
3
+ size 1382228
models/tokenizer/es_tokenizer_64k.vocab ADDED
The diff for this file is too large to render. See raw diff
 
models/tokenizer/es_tokenizer_8k.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5089d962d73639dbf53ee741cd6e2d28bd36703e0b6d6567891b76efc68d879
3
+ size 377102
models/tokenizer/es_tokenizer_8k.vocab ADDED
The diff for this file is too large to render. See raw diff
 
models/vocabulary/es_vocabulary.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d4d3d12dfc50b538e3861deec092ee8c256b82688dc2d960c32101d41717f10
3
+ size 17156955