--- language: - ku - ckb - kmr - hac size_categories: - 1B2B tokens) for large-scale language modeling and downstream NLP. - **Dialects:** Sorani (ckb), Kurmanji/Badini (kmr), Hawrami/Gorani (hac) - **License:** CC BY 4.0 - **Repo:** https://huggingface.co/datasets/abdulhade/Kurdishcorpus - **External record:** Mendeley Data DOI `10.17632/fb5xhhn6m5.1` --- ## TL;DR - Ready for **pretraining** and **finetuning** Kurdish LMs - Single field **`text`** (UTF-8), offered as large archives or sharded `.txt(.gz)` - Includes **normalization and cleaning** (Unicode, orthography, noise removal with placeholders like `[URL]`, `[EMAIL]`) - No official splits; create your own task-specific splits and report dialect coverage --- ## Quickstart ```python from datasets import load_dataset # Stream without downloading everything at once (recommended for very large corpora) ds = load_dataset("abdulhade/Kurdishcorpus", split="train", streaming=True) for i, ex in enumerate(ds.take(5)): print(ex["text"]) ``` # Text Normalization (AsoSoft Library) This repository documents how Central Kurdish text is normalized with the **AsoSoft Library** before release. The goal is to standardize Unicode, punctuation, numerals, and common web artifacts so downstream tokenizers and language models see clean, consistent text. - Library: **AsoSoft Library** (C#/.NET) by Aso Mahmudi - Repo: https://github.com/AsoSoft/AsoSoft-Library - Scope: Kurdish Sorani (ckb) primary, with script-agnostic steps for other Kurdish varieties (kmr, hac) --- ## Why normalize - Reduce spurious vocabulary caused by look-alike glyphs and legacy encodings. - Ensure consistent numerals and punctuation for stable tokenization. - Replace privacy-sensitive artifacts like URLs and emails with safe placeholders. - Remove invisible noise (tatweel, zero-widths, control chars) that hurts training. --- ## What the pipeline does ### 1) Legacy encodings to Unicode (conditional) Applied only when legacy font artifacts are detected. - `AliK2Unicode` - `AliWeb2Unicode` - `Dylan2Unicode` - `Zarnegar2Unicode` ### 2) HTML and web artifacts - `ReplaceHtmlEntity` converts entities (e.g. `"` → `"`). - `ReplaceUrlEmail` replaces URLs and emails with `[URL]` and `[EMAIL]`. ### 3) Unicode standardization and Kurdish-specific fixes `Normalize(...)` with deep and additional corrections enabled. - Replace Arabic Presentation Forms with standard code points. - Remove Tatweel U+0640 and stray control/zero-width characters. - Normalize dashes and spaces. - Map visually similar Arabic letters to Kurdish standard forms (e.g. ڪ, ے, ٶ → ک, ی, ؤ). - Kurdish-specific standardization of `ە, هـ, ی, ک`. - Correct frequent mis-conversions from non-Unicode fonts. - Optionally convert word-initial `ر` to `ڕ`. ### 4) Punctuation and whitespace - `NormalizePunctuations(text, separateAllPunctuations=false)` ensures no extra spaces around punctuation. - `TrimLine` trims leading/trailing whitespace including zero-width spaces. ### 5) Numerals and digit separation - `UnifyNumerals(text, "en")` normalizes all digits to ASCII 0–9 for tokenizer stability. - `SeperateDigits` inserts spaces between digits and adjacent letters (e.g. `12کەس` → `12 کەس`). > Note: For kmr/hac lines, we only apply script-agnostic steps (HTML/entity cleanup, URL/email replacement, Unicode cleanup, punctuation, numerals, trimming). We do not transliterate or run G2P on released text. --- ## Reproducible configuration We run the following configuration in order. The last step that applies is the one whose conditions are met. ```csharp using AsoSoftLibrary; string NormalizeCkbLine(string text) { // 1) Legacy converters (conditional, heuristic triggers) if (LooksLikeAliK(text)) text = AsoSoft.AliK2Unicode(text); if (LooksLikeAliWeb(text)) text = AsoSoft.AliWeb2Unicode(text); if (LooksLikeDylan(text)) text = AsoSoft.Dylan2Unicode(text); if (LooksLikeZarnegar(text)) text = AsoSoft.Zarnegar2Unicode(text); // 2) HTML and web artifacts text = AsoSoft.ReplaceHtmlEntity(text); text = AsoSoft.ReplaceUrlEmail(text); // replaces with [URL], [EMAIL] // 3) Unicode standardization (+ Kurdish fixes) // changeInitialR=true enables initial ر → ڕ text = AsoSoft.Normalize( text: text, isOnlyKurdish: true, changeInitialR: true, deepUnicodeCorrectios: true, additionalUnicodeCorrections: true, usersReplaceList: null ); // 4) Punctuation and whitespace text = AsoSoft.NormalizePunctuations(text, separateAllPunctuations: false); text = AsoSoft.TrimLine(text); // 5) Numerals and digit separation text = AsoSoft.UnifyNumerals(text, "en"); text = AsoSoft.SeperateDigits(text); return text; } ``` Heuristic detectors like `LooksLikeAliK` check for characteristic code points and glyph ranges associated with each legacy font family. The converters are applied only when such patterns are present. --- ## Before and after examples ``` Input : دەقی«کوردی » و ڕێنووس ،((خاڵبەندی )) چۆنە ؟ Output: دەقی «کوردی» و ڕێنووس، «خاڵبەندی» چۆنە? ``` ``` Input : ژمارەکانی ٤٥٦ و ۴۵۶ و 456 Output: ژمارەکانی 456 و 456 و 456 ``` ``` Input : دەقے شیَعري خـــۆش. ره‌نگه‌كاني خاك Output: دەقی شێعری خۆش. ڕەنگەکانی خاک ``` ``` Input : ئێوە "دەق" لە زمانی <کوردی> دەنووسن Output: ئێوە "دەق" بە زمانی <کوردی> دەنووسن ``` ``` Input : لە ساڵی1950دا1000دۆلاریان بە 5کەس دا Output: لە ساڵی 1950 دا 1000 دۆلاریان بە 5 کەس دا ``` --- ## What we do not do - No transliteration or G2P on the released corpus. The text remains in its native script. - No poem meter classification during release processing. - No semantic rewriting beyond canonical character and punctuation normalization. --- ## Dialect coverage policy - **ckb**: full AsoSoft normalization including Kurdish-specific fixes. - **kmr/hac**: script-agnostic cleanup only. We avoid ckb-specific letter substitutions to preserve dialectal orthography and phonology. --- ## Quality checks - Character inventory auditing before and after normalization. - Proportion of placeholders `[URL]`, `[EMAIL]` to detect crawler bias. - Count of removed control and zero-width characters. - Round-trip sampling with spot manual verification on ambiguous lines. - Determinism check: same input produces same output across runs. --- ## Reproducing locally 1. Install .NET 6 or newer. 2. Add AsoSoft Library via NuGet in your C# project. 3. Pipe your text through a console app using the configuration above. Example console usage: ```bash dotnet run --project NormalizerApp --input data/raw.txt --output data/normalized.txt ``` Where `NormalizerApp` calls `NormalizeCkbLine` for each line. --- ## Parameters you can tune - `changeInitialR`: set to `false` if you do not want `ر` to become `ڕ` word-initially. - `UnifyNumerals` target: `"en"` for ASCII 0–9 or `"ar"` for Arabic-Indic digits, depending on your tokenizer. - `separateAllPunctuations`: set to `true` if you prefer all punctuation to be isolated by spaces for whitespace-tokenized pipelines. --- ## Cite If you use **KurCorpus 2B**, please cite: [![DOI](https://img.shields.io/badge/DOI-10.17632%2Ffb5xhhn6m5.1-orange)](https://doi.org/10.17632/fb5xhhn6m5.1) **BibTeX** ```bibtex @dataset{rawf2025kurcorpus2b, title = {KurCorpus 2B: A Multidialectal 2-Billion-Token Corpus for Kurdish Language Modeling}, author = {Rawf, Karwan Mahdi and Abdullah, Abdullah and Hussein, Amanj and Mohammed, Haukar}, year = {2025}, version = {1}, howpublished = {Mendeley Data}, doi = {10.17632/fb5xhhn6m5.1} }