Datasets:
The dataset viewer is not available for this split.
Error code: TooBigContentError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Persian Corpus (normalized)
Persian web text (blogs, forum posts and Q&A) normalized for language-model training that must match
ASR output. The original un-normalized merged_dataset.jsonl (28.7 GB, 12,045,384 rows) has been removed
from the repo; only the normalized corpus is published.
| source (removed) | normalized | |
|---|---|---|
| Rows | 12,045,384 | 11,916,275 |
| Size | 28.7 GB JSONL | 8.2 GB parquet (zstd) |
| Columns | label, text |
text, label |
Rows by source label: blogs 11,631,083 · questions 264,933 · ninisite 20,259.
Rows dropped: 126,591 exact duplicates (after normalization), 1,681 shorter than three words, 837 mostly non-Persian script.
Normalization
Applied to every row by persian_normalizer.py with zwnj_lexicon.json (both in this repo). It is the
same normalizer as FarhanFarsi/subkade-persian-subtitles-lm,
so the two corpora spell words identically. Steps 8 and 9 below are corpus-specific repairs applied after it.
Character unification. NFKC (folds Arabic presentation forms such as ﻻ), then 112 Arabic, Urdu, Kurdish, Pashto and Sindhi letter forms mapped to Persian: ي ى → ی, ك → ک, ة → ه, أ إ ٱ → ا, ؤ → و, ھ ہ → ه, ۀ → هی, ڤ → ف, ٹ → ت, ۆ → و, ں → ن, and so on. Persian and Arabic-Indic digits are unified.
Diacritics, tatweel and bidi marks removed. A word-final damma, used informally for the object marker, becomes و (کارُ → کارو). A detached tatweel suffix is re-attached (پورشم ـه → پورشمه).
Numbers spelled out: ۲۵ → بیست و پنج, ۳ام → سوم, 50% → پنجاه درصد, 0047 → صفر صفر چهل و هفت.
Bracketed notes removed ([...], (...), {...}, <...>), then all punctuation and Latin or other non-Persian letters removed. The output alphabet is the 32 Persian letters plus ء and ئ, nim-fasele (U+200C) and single spaces.
Stretched words collapsed: letter runs are capped at three, then each stretched form is mapped to the more frequent of its one-letter and two-letter collapse: خدااااا → خدا, خیییلی → خیلی, سلااام → سلام, بببین → ببین, مممنون → ممنون. A collapse never produces a single letter or a different word, so interjections stay distinct: هممممم → همم (not هم), اووو → اوو (not او), ششش stays ششش.
Nim-fasele: the می/نمی prefix always takes ZWNJ, as do plural های/هایی after a word. ZWNJ is removed where it is invisible (after ا د ذ ر ز ژ و ء آ) so each visible word has a single encoding.
Corpus-derived nim-fasele lexicon (
zwnj_lexicon.json: 48,347 word fixes, 21,336 two-word fixes), built from how often each spelling (joined / nim-fasele / spaced) occurs in the subtitle corpus:- affixes (می، نمی، بی، plural ها، suffixes after silent ه such as ای ام ی) → nim-fasele: میدونم → میدونم, کتابها → کتابها, بچه ها → بچهها, خونه ی → خونهی
- pronoun suffixes → joined, the standard spelling: اسمشون → اسمشون, کمکتون → کمکتون
- other compounds → the most frequent spelling, applied to every variant: هیچ وقت / هیچوقت → هیچوقت, خیلیخب → خیلی خب, بهنظر → به نظر
- distinct words are left alone: تنها, فرماندهی vs فرماندهی
Decimal repair (this corpus only). The source had lost its decimal points before this pass, so 57.2 arrived as two numbers (
۵۷ ۲) and was first spelled پنجاه و هفت دو درصد.fix_decimals.pyinserts ممیز where two spelled-out numbers stand directly before a unit word (درصد, متر, سانتی متر, کیلوگرم, تومان, میلیون, ...) with no و between them: پنجاه و هفت ممیز دو درصد, صفر ممیز پنج درصد, پنج ممیز چهار سانتی متر. Ascending single digits are left alone because they are an approximation (دو سه متر = two or three metres), as are scale words (دو هزار تومان). 106,995 rows changed.آ restored (this corpus only). The source had flattened آ to ا (ادم, اقای, قران).
build_alef_lexicon.pycompares every corpus word with ا against the subtitles LM corpus, which kept آ: a spelling with آ is adopted when it is at least twice as frequent there as the flattened form (minimum 5 occurrences), givingalef_lexicon.jsonwith 7,152 words: ادم → آدم, اقای → آقای, قران → قرآن, اب → آب, ایا → آیا, اموزش → آموزش, امریکا → آمریکا, اینده → آینده, درامد → درآمد, میامیزند → میآمیزند. Words the reference does not know with آ keep their flattened spelling, and genuinely ambiguous forms (اه/آه, اش/آش) are left unchanged. 8,605,978 rows changed (72% of the corpus).
Use the same normalizer on ASR transcripts and hypotheses so ASR and LM spell words identically:
from persian_normalizer import PersianNormalizer
norm = PersianNormalizer("zwnj_lexicon.json")
norm("ميدونم كه ۲۵ تا كتاب ها رو خوندي!") # -> 'میدونم که بیست و پنج تا کتابها رو خوندی'
Usage
from datasets import load_dataset
ds = load_dataset("FarhanFarsi/persian_corpus", split="train")
- Downloads last month
- 133