--- language: hu language_name: Hungarian language_family: uralic_ugric 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-uralic_ugric license: mit library_name: wikilangs pipeline_tag: text-generation datasets: - omarkamali/wikipedia-monthly dataset_info: name: wikipedia-monthly description: Monthly snapshots of Wikipedia articles across 300+ languages metrics: - name: best_compression_ratio type: compression value: 4.661 - name: best_isotropy type: isotropy value: 0.7886 - name: best_alignment_r10 type: alignment value: 0.9180 - name: vocabulary_size type: vocab value: 1458224 generated: 2026-03-04 --- # Hungarian — Wikilangs Models Open-source tokenizers, n-gram & Markov language models, vocabulary stats, and word embeddings trained on **Hungarian** Wikipedia by [Wikilangs](https://wikilangs.org). 🌐 [Language Page](https://wikilangs.org/languages/hu/) · 🎮 [Playground](https://wikilangs.org/playground/?lang=hu) · 📊 [Full Research Report](RESEARCH_REPORT.md) ## Language Samples Example sentences drawn from the Hungarian Wikipedia corpus: > magyar nép magyar nyelv Magyarország Magyar állampolgárság Magyar, régi magyar családnév > A Tejútrendszer szinonimája a csillagászatban Galaktika, egy tudományos-fantasztikus antológia neve > Óe, japán családnév Óe, kisváros Japánban, Jamagata prefektúrában ÓE, az Óbudai Egyetem rövidítése > Szó fogalma a nyelvészetben Szó fogalma a matematikai logikában és a formális nyelvek elméletében Szó fogalma az informatikában Szó fogalma a zenében Szo, japán kana > Memória (biológia) Memória (számítástechnika): Számítástechnikában használják Memória (játék) Párkereső kártyajáték ## Quick Start ### Load the Tokenizer ```python import sentencepiece as spm sp = spm.SentencePieceProcessor() sp.Load("hu_tokenizer_32k.model") text = "Elvonás, addiktológia Elvonás, a szóalkotás egy módja" tokens = sp.EncodeAsPieces(text) ids = sp.EncodeAsIds(text) print(tokens) # subword pieces print(ids) # integer ids # Decode back print(sp.DecodeIds(ids)) ```
Tokenization examples (click to expand) **Sample 1:** `Elvonás, addiktológia Elvonás, a szóalkotás egy módja` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁elv on ás , ▁ad d ikt ológia ▁elv on … (+9 more)` | 19 | | 16k | `▁elv on ás , ▁add ikt ológia ▁elv on ás … (+8 more)` | 18 | | 32k | `▁elvon ás , ▁add ikt ológia ▁elvon ás , ▁a … (+5 more)` | 15 | | 64k | `▁elvon ás , ▁add ikt ológia ▁elvon ás , ▁a … (+4 more)` | 14 | **Sample 2:** `Memória (biológia) Memória (számítástechnika): Számítástechnikában használják Me…` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁mem ória ▁( bi ológia ) ▁mem ória ▁( szám … (+23 more)` | 33 | | 16k | `▁mem ória ▁( bi ológia ) ▁mem ória ▁( számítás … (+19 more)` | 29 | | 32k | `▁memória ▁( bi ológia ) ▁memória ▁( számítás technika ): … (+12 more)` | 22 | | 64k | `▁memória ▁( biológia ) ▁memória ▁( számítás technika ): ▁számítástechn … (+10 more)` | 20 | **Sample 3:** `Óe, japán családnév Óe, kisváros Japánban, Jamagata prefektúrában ÓE, az Óbudai …` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁ó e , ▁japán ▁család név ▁ó e , ▁kis … (+21 more)` | 31 | | 16k | `▁ó e , ▁japán ▁családnév ▁ó e , ▁kisváros ▁japánban … (+16 more)` | 26 | | 32k | `▁ó e , ▁japán ▁családnév ▁ó e , ▁kisváros ▁japánban … (+13 more)` | 23 | | 64k | `▁ó e , ▁japán ▁családnév ▁ó e , ▁kisváros ▁japánban … (+11 more)` | 21 |
### Load Word Embeddings ```python from gensim.models import KeyedVectors # Aligned embeddings (cross-lingual, mapped to English vector space) wv = KeyedVectors.load("hu_embeddings_128d_aligned.kv") similar = wv.most_similar("word", topn=5) for word, score in similar: print(f" {word}: {score:.3f}") ``` ### Load N-gram Model ```python import pyarrow.parquet as pq df = pq.read_table("hu_3gram_word.parquet").to_pandas() print(df.head()) ``` ## Models Overview ![Performance Dashboard](visualizations/performance_dashboard.png) | Category | Assets | |----------|--------| | Tokenizers | BPE at 8k, 16k, 32k, 64k vocab sizes | | N-gram models | 2 / 3 / 4 / 5-gram (word & subword) | | Markov chains | Context 1–5 (word & subword) | | Embeddings | 32d, 64d, 128d — mono & aligned | | Vocabulary | Full frequency list + Zipf analysis | | Statistics | Corpus & model statistics JSON | ## Metrics Summary | Component | Model | Key Metric | Value | |-----------|-------|------------|-------| | Tokenizer | 8k BPE | Compression | 3.50x | | Tokenizer | 16k BPE | Compression | 3.92x | | Tokenizer | 32k BPE | Compression | 4.31x | | Tokenizer | 64k BPE | Compression | 4.66x 🏆 | | N-gram | 2-gram (subword) | Perplexity | 429 🏆 | | N-gram | 2-gram (word) | Perplexity | 362,917 | | N-gram | 3-gram (subword) | Perplexity | 4,501 | | N-gram | 3-gram (word) | Perplexity | 1,261,909 | | N-gram | 4-gram (subword) | Perplexity | 29,749 | | N-gram | 4-gram (word) | Perplexity | 2,487,801 | | N-gram | 5-gram (subword) | Perplexity | 135,455 | | N-gram | 5-gram (word) | Perplexity | 1,806,602 | | Markov | ctx-1 (subword) | Predictability | 0.0% | | Markov | ctx-1 (word) | Predictability | 5.8% | | Markov | ctx-2 (subword) | Predictability | 32.3% | | Markov | ctx-2 (word) | Predictability | 68.8% | | Markov | ctx-3 (subword) | Predictability | 23.4% | | Markov | ctx-3 (word) | Predictability | 88.4% | | Markov | ctx-4 (subword) | Predictability | 25.2% | | Markov | ctx-4 (word) | Predictability | 96.0% 🏆 | | Vocabulary | full | Size | 1,458,224 | | Vocabulary | full | Zipf R² | 0.9963 | | Embeddings | mono_32d | Isotropy | 0.7886 | | Embeddings | mono_64d | Isotropy | 0.7831 | | Embeddings | mono_128d | Isotropy | 0.7114 | | Embeddings | aligned_32d | Isotropy | 0.7886 🏆 | | Embeddings | aligned_64d | Isotropy | 0.7831 | | Embeddings | aligned_128d | Isotropy | 0.7114 | | Alignment | aligned_32d | R@1 / R@5 / R@10 | 36.0% / 62.8% / 75.2% | | Alignment | aligned_64d | R@1 / R@5 / R@10 | 53.2% / 77.0% / 85.6% | | Alignment | aligned_128d | R@1 / R@5 / R@10 | 63.0% / 85.4% / 91.8% 🏆 | 📊 **[Full ablation study, per-model breakdowns, and interpretation guide →](RESEARCH_REPORT.md)** --- ## About Trained on [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) — monthly snapshots of 300+ Wikipedia languages. A project by **[Wikilangs](https://wikilangs.org)** · Maintainer: [Omar Kamali](https://omarkamali.com) · [Omneity Labs](https://omneitylabs.com) ### Citation ```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} } ``` ### Links - 🌐 [wikilangs.org](https://wikilangs.org) - 🌍 [Language page](https://wikilangs.org/languages/hu/) - 🎮 [Playground](https://wikilangs.org/playground/?lang=hu) - 🤗 [HuggingFace models](https://huggingface.co/wikilangs) - 📊 [wikipedia-monthly dataset](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) - 👤 [Omar Kamali](https://huggingface.co/omarkamali) - 🤝 Sponsor: [Featherless AI](https://featherless.ai) **License:** MIT — free for academic and commercial use. --- *Generated by Wikilangs Pipeline · 2026-03-04 18:37:58*