KS-PRET-5M: Kashmiri Pretraining Corpus
5,090,244 words · ~12,130,000 subword tokens · 295,433 vocabulary · April 2026
Building the complete AI stack for Kashmiri — 7 million speakers, virtually no prior computational resources.
Dataset Summary
KS-PRET-5M is a large-scale, deeply cleaned Kashmiri language pretraining corpus — the largest publicly available dataset for the Kashmiri language. All text is formatted as a single continuous stream, the standard format for autoregressive LLM pretraining.
The corpus is built digitized archival and literary sources (Litratature,News,Biographies,Novels,Writings,Poems,and more), processed through an 11-stage cleaning pipeline that preserves Nastaliq script fidelity while removing noise, Latin text, duplicates, and encoding artifacts.
Subword token count is empirically measured at 2.383 tokens per word using google/muril-base-cased, reflecting the high diacritic density of written Kashmiri Nastaliq — yielding approximately 12.1 million real subword tokens.
Dataset Statistics
Core Metrics
| Metric | Value |
|---|---|
| Language | Kashmiri (ks) |
| Primary script | Nastaliq / Perso-Arabic |
| Secondary script | Devanagari |
| Total characters | 27,692,959 |
| Total words | 5,090,244 |
| Vocabulary size | 295,433 unique word types |
| Type-token ratio (TTR) | 0.0580 |
| Hapax legomena | 140,063 |
| Avg word frequency | 17.23x |
| Subword tokens (measured, 2.383x) | ~12,130,051 |
| Mean KS ratio | 0.9965 |
| Devanagari chars | 146 (< 0.001%) |
| Unique Unicode codepoints | 284 |
| Corpus format | Single continuous line |
| File size (TXT) | 47.88 MB |
| Build date | April 2026 |
| License | CC BY 4.0 |
Script Purity Breakdown
| Script / Category | Character Count | Share |
|---|---|---|
| Nastaliq / Arabic script | 22,510,292 | 81.3% |
| Kashmiri punctuation (،؟؛۔) | 156,544 | 0.57% |
| Arabic-Indic numerals (٠-٩) | 78,626 | 0.28% |
| Devanagari script | 146 | < 0.001% |
| Whitespace and other | remainder | — |
v1 to KS-PRET-5M Comparison
| Metric | v1 Baseline | KS-PRET-5M | Change |
|---|---|---|---|
| Total characters | 25,244,298 | 27,692,959 | +2,448,661 (+9.7%) |
| Total words | 4,658,294 | 5,090,244 | +431,950 (+9.3%) |
| Vocabulary size | 261,604 | 295,433 | +33,829 (+12.9%) |
| Type-token ratio | 0.0562 | 0.0580 | +0.0018 |
| Subword tokens | ~8,311,074 | ~12,130,051 | +3,818,977 |
| Mean KS ratio | 0.9944 | 0.9965 | +0.0021 |
| File size | 43.66 MB | 47.88 MB | +4.22 MB |
Vocabulary grew faster (+12.9%) than word count (+9.3%), indicating that new sources contributed genuine lexical diversity rather than high-frequency repetition.
Demo
Usage
Load with Hugging Face Datasets
from datasets import load_dataset
ds = load_dataset(
"Omarrran/KS-PRET-5M_5_million_kashmiri_Pretrainning_LLM_dataset_12M_tokens_2026",
split="train"
)
print(ds[0]["text"])
Direct text loading
with open("KS-PRET-5M.txt", encoding="utf-8") as f:
text = f.read()
print(f"Characters : {len(text):,}")
print(f"Words : {len(text.split()):,}")
Tokenizer training (BPE / SentencePiece)
from tokenizers import SentencePieceBPETokenizer
tokenizer = SentencePieceBPETokenizer()
tokenizer.train_from_iterator(
iter(text.split("۔")), # split on Kashmiri full stop
vocab_size=32000,
special_tokens=["<pad>", "<unk>", "<s>", "</s>"]
)
Verifying subword token count
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("google/muril-base-cased")
# Sample 500K chars and extrapolate
sample = text[:500_000]
tokens = tokenizer(sample, truncation=False)
ratio = len(tokens["input_ids"]) / len(sample.split())
print(f"Subword ratio: {ratio:.3f}x")
# Expected: ~2.383x for Kashmiri Nastaliq
Metadata record format
{
"datatype" : "TEXT",
"lang" : "ks",
"script" : "Nastaliq",
"ks_ratio" : 0.9965,
"version" : "KS-PRET-5M"
}
Cleaning Pipeline
All text was processed through an 11-stage pipeline applied to raw Kashmiri web and archival sources.
| Stage | Operation |
|---|---|
| 1 | Encoding repair (ftfy) — fixes mojibake and broken Unicode sequences |
| 2 | Code block removal — Markdown fences, inline code, HTML and XML tags |
| 3 | URL and email removal |
| 4 | Phone number removal (internationa and India formats) |
| 5 | Latin script removal — all English and Roman-script words stripped |
| 6 | Noise symbol removal — emoji, control characters, box-drawing characters |
| 7 | Western digit string removal — large numeric sequences removed |
| 8 | Whitespace normalisation — multiple spaces and tabs collapsed |
| 9 | Line-level filtering by KS script ratio, English word ratio, digit ratio |
| 10 | MD5 exact deduplication |
| 11 | then joined into single continuous stream |
Preserved Unicode Ranges
| Content | Unicode Range |
|---|---|
| Kashmiri Nastaliq text | U+0600–U+06FF |
| Arabic presentation forms A | U+FB50–U+FDFF |
| Arabic presentation forms B | U+FE70–U+FEFF |
| Arabic supplement | U+0750–U+077F |
| Devanagari Kashmiri | U+0900–U+097F |
| Arabic-Indic digits | U+0660–U+06F9 |
| Kashmiri punctuation | U+060C, U+061B, U+061F, U+06D4 |
| Diacritics and harakaat | within Arabic block |
Diacritics and harakaat are fully preserved — they are critical for phonological disambiguation in written Kashmiri.
Recommended Use Cases
| Use Case | Notes |
|---|---|
| LLM pretraining | Sufficient scale for small Kashmiri-specific language models |
| Tokenizer training | BPE, Unigram, or SentencePiece tuned to Nastaliq diacritic density |
| Multilingual fine-tuning | Domain adaptation for mBERT, XLM-R, IndicBERT |
| Linguistic research | Frequency analysis, n-gram modeling, morphological studies |
| ASR / TTS normalization | Written-form corpus for Kashmiri speech pipeline development |
| NLP benchmarking | Baseline for Kashmiri language evaluation tasks |
Limitations
- Text only — no speaker metadata, domain labels, source URLs, or timestamps.
- Script is Nastaliq-primary. Devanagari Kashmiri content is minimal (146 chars total).
- Subword token count is measured using
google/muril-base-cased. Counts will differ with a Kashmiri-native BPE tokenizer trained on this corpus. - Sources include web-crawled text. Informal register, minor OCR artifacts from digitized sources, and aggregator repetition may be present despite deduplication.
- Dialectal variation is present and not separated by region or register.
License
This dataset is released under Creative Commons Attribution 4.0 International (CC BY 4.0).
Full license: https://creativecommons.org/licenses/by/4.0/
Permitted Uses
- Non-commercial research and experimentation
- Academic publications and benchmarking
- Training AI and NLP models for Kashmiri language research
- Open scientific collaboration aligned with language preservation
- Internal evaluation and analysis
All permitted uses require proper attribution (see Citation section).
Prohibited Uses
- Redistribution, mirroring, or re-hosting of the data (public or private)
- Commercial products, services, APIs, or SaaS offerings without written permission
- Training proprietary or closed-source models without a separate agreement
- Reconstructing the dataset via model outputs
- Combining into other datasets for redistribution
- Claiming ownership or exclusive rights over the data
- Surveillance, profiling, or harmful applications
Commercial Licensing
Any commercial use requires explicit written permission and a separate licensing agreement prior to use.
Contact: Hnm{dot}cs{dot}ai{at}outlook{dot}com
Violation of these terms results in immediate and permanent revocation of access.
Citation
@dataset{malik2026kspret5m,
title = {{KS-PRET-5M}:A 5 Million Word, 12 Million Token Kashmiri Pretraining Dataset},
author = {Haq Nawaz Malik and Nahfid Nissar},
year = {2026},
month = {April},
url = {https://huggingface.co/datasets/Omarrran/5_million_kashmiri_Pretrainning_LLM_dataset_8M_tokens_2026},
license = {cc-by-4.0},
note = {5,090,244 words · 295,433 vocabulary · ~12.1M subword tokens · KS ratio 0.9965}
}
Meet the another author: Nahfid Nissar.
Required attribution locations: research papers, model cards, GitHub repositories, public demos and reports.
Contact
Haq Nawaz Malik (Omar) AI Engineer
Contact: Hnm{dot}cs{dot}ai{at}outlook{dot}com
Hugging Face: https://huggingface.co/Omarrran
Built with care for the Kashmiri language and its speakers.
- Downloads last month
- 12