| --- |
| license: cc-by-sa-4.0 |
| language: |
| - so |
| size_categories: |
| - 100K<n<1M |
| task_categories: |
| - text-generation |
| - fill-mask |
| pretty_name: SomaliWeb v1 |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: "train-*.parquet" |
| - split: validation |
| path: validation.parquet |
| tags: |
| - somali |
| - low-resource |
| - pretraining |
| - web-corpus |
| - deduplicated |
| - quality-filtered |
| - arxiv:2605.18232 |
| --- |
| |
| # SomaliWeb v1 — Quality-filtered Somali web corpus |
|
|
| [](https://arxiv.org/abs/2605.18232) |
| [](https://github.com/khaledyusuf44/somali-corpus) |
|
|
| **📄 Paper:** [arXiv:2605.18232](https://arxiv.org/abs/2605.18232) — *SomaliWeb v1: A Quality-Filtered Somali Web Corpus with a Matched Tokenizer and a Public Language-Identification Benchmark* |
|
|
| **💻 Construction pipeline (MIT):** [github.com/khaledyusuf44/somali-corpus](https://github.com/khaledyusuf44/somali-corpus) |
|
|
| **SomaliWeb v1** is a cleaned, deduplicated, and quality-filtered Somali-language web corpus of **~303 million tokens** (819,322 documents), built by aggregating three public Somali-heavy web distributions (HPLT v2, CC100, Somali Wikipedia) and passing them through a reproducible six-stage pipeline. |
|
|
| This is, to our knowledge, the first dedicated and versioned Somali-only pretraining corpus released on Hugging Face with a complete dataset card, a matched tokenizer, and a public language-identification benchmark. The full audit-trail, equations, and findings are documented in the companion paper ([arXiv:2605.18232](https://arxiv.org/abs/2605.18232)). |
|
|
| ## Dataset summary |
|
|
| - **Language**: Somali (Standard Somali, Latin script). No Maay Maay detected in the final distribution. |
| - **Token count**: ~303M approximate tokens (`words × 1.3`), **233M whitespace-separated words**. |
| - **Document count**: 819,322 (train: 778,355 · validation: 40,967, 95/5 split). |
| - **Script**: Latin. |
| - **Period of source content**: ~2019–2024, inherited from HPLT v2 and CC100. |
| - **License**: CC-BY-SA 4.0 (see Licensing below; sources have compatible terms). |
|
|
| ## Why this dataset |
|
|
| Somali is a low-resource language with ~25 million speakers worldwide. Existing Somali text appears *inside* multilingual dumps (HPLT, CC100, mC4, OSCAR) but no standalone, named, versioned Somali pretraining corpus has been published with a documented construction pipeline. SomaliWeb v1 fills that gap and ships with: |
|
|
| - A reproducible pipeline anyone can re-run and audit. |
| - A comparison baseline tokenizer trained on HPLT-raw, released alongside. |
| - An evaluation against FLORES-200 Somali showing measurable fertility improvements over general-purpose tokenizers. |
|
|
| ## Dataset structure |
|
|
| ### Data fields |
|
|
| Each row in the train shards (`train-*.parquet`) and `validation.parquet` has the schema: |
|
|
| - `id` (string): source-prefixed unique identifier (e.g. `hplt2-so_12345`). |
| - `text` (string): the document body, cleaned and length-filtered. |
| - `source` (string): one of `hplt2-so`, `cc100-so`, `wikipedia-so`. |
| - `n_words` (int): whitespace-separated word count after cleaning. |
| - `quality_score` (float): Phase-5 quality score (0–1, higher = cleaner Somali). |
| - `lang_conf` (float): langdetect top-1 confidence for Somali. |
| - `dialect_tag` (string, optional): GlotLID v3 dialect tag (almost always `som_Latn`). |
|
|
| ### Data splits |
|
|
| | Split | Documents | Approx tokens | |
| |---|---:|---:| |
| | `train` (95%) | 778,355 | ~288M | |
| | `validation` (5%) | 40,967 | ~15M | |
|
|
| ### Source composition (of the combined train + validation) |
|
|
| | Source | Documents | Fraction | |
| |---|---:|---:| |
| | HPLT v2 `som_Latn` | 582,257 | 71.07% | |
| | CC100-so (statmt.org) | 233,394 | 28.49% | |
| | Somali Wikipedia (dump 2023-11-01) | 3,671 | 0.45% | |
|
|
| ## Construction pipeline |
|
|
| Full details + intermediate metrics in the companion GitHub repository's `reports/` directory. The pipeline is six phases: |
|
|
| 1. **Merge + byte-exact dedup.** Combine the three sources under a unified schema; drop documents whose SHA-256 of `lowercase(whitespace-collapsed(text))` is already seen (first-seen wins). Removed **189,692 duplicates (13.83%)**, of which **166,628 (17.3%) came from within HPLT v2's own "cleaned" distribution**, demonstrating that HPLT's dedup is not byte-exact. |
|
|
| 2. **Clean + normalize.** Mojibake fix via `ftfy`, whitespace collapse, repeated-char-run collapse, minimum-length filter (≥ 50 words). **ftfy fixed mojibake in 615,314 documents (52.04% of input)** — notably **56.1% of HPLT v2's documents** contained fixable encoding artifacts. |
|
|
| 3. **LID verification.** `langdetect` (seeded) on every surviving document; keep only top-1 = `so` with confidence ≥ 0.50. Drop rate 0.21% — HPLT/CC100 already LID-filtered solidly. GlotLID v3 second pass tagged dialect: `som_Latn` 99.96%, `ymm_Latn` (Maay Maay) 0.00%. |
|
|
| 4. **MinHash near-duplicate detection.** Word-3-gram shingles hashed inline to 31-bit ints, 64 MinHash signatures, (16, 4) LSH banding (`s* ≈ 0.50`), τ = 0.80 Jaccard verification, union-find clustering, `keep-longest` rule. Removed **113,896 near-duplicates (10.57%)**. Largest cluster: 75 copies of one article — HPLT missed it. |
|
|
| 5. **Quality filter.** Character 5-gram coverage against a clean Somali Wikipedia seed (2,221 articles ≥ 200 words, 828K unique 5-grams). Dropped bottom 15% by coverage score (threshold 0.9029). Filter catches template-like listings and encoding-degraded content; a known false-positive rate applies to news with heavy proper-noun density. |
|
|
| 6. **Release structuring.** Shuffled (seed 0), 95/5 train/val split, metadata consolidated. |
|
|
| ## Evaluation |
|
|
| ### Tokenizer fertility on FLORES-200 Somali devtest (1,012 held-out sentences) |
|
|
| | Tokenizer | Training corpus | Vocab | Tokens | Fertility ↓ | |
| |---|---|---:|---:|---:| |
| | **SomaliWeb-v1** (this dataset) | 350M tokens (cleaned) | 16K | 35,867 | **1.538** | |
| | HPLT-raw | 505M tokens (raw HPLT v2) | 16K | 35,854 | 1.537 | |
| | GPT-4 `cl100k_base` | proprietary | 100K | 60,010 | 2.573 | |
|
|
| **Two results:** |
|
|
| - SomaliWeb v1 matches HPLT-raw's tokenizer fertility at 30% smaller training corpus — our dedup + quality filter preserves tokenizer quality. |
| - SomaliWeb v1's tokenizer is **40.2% more token-efficient than GPT-4's `cl100k_base`** on Somali text. The "tokenization tax" that penalizes low-resource languages is concretely measurable here. |
| |
| The companion tokenizer is published alongside as `tokenizer_somaliweb.json` (HF tokenizers JSON format). |
| |
| ## Limitations and considerations |
| |
| - **Source inheritance.** The upstream sources (HPLT v2, CC100, Somali Wikipedia) each have their own coverage biases. HPLT and CC100 are CC-derived and therefore dominated by whatever Somali content happened to be on the public web during ~2019–2024. |
| - **No Maay Maay.** GlotLID v3 tagged 0 documents as `ymm_Latn` in the final distribution. Either the upstream distributions filtered it out, or GlotLID undercounts Maay on web text — either way, this corpus should be described as **Standard Somali only**. Future versions should source Maay Maay content separately. |
| - **Quality filter false positives.** The char-5-gram filter can drop real news articles heavy in proper nouns because the seed is predominantly Wikipedia encyclopedic prose. v2 should use a mixture seed or a trained classifier. |
| - **Known encoding artifacts caught, not created.** 52% of docs had mojibake fixed by `ftfy`. We did not find evidence of residual mojibake, but this hasn't been exhaustively audited. |
| - **Dialect scope.** Standard Somali only. |
| - **PII.** We did not run a dedicated PII-removal pass. Upstream sources may retain names, phone numbers, or emails embedded in news content. Empirical scan of the released splits: **~7.9% of documents contain at least one email-shaped string** (mostly newsroom contact addresses such as `editor@…`, `support@…`, but also occasional personal `gmail.com` / `hotmail.com` addresses). Presidio does not cover Somali; a Somali-specific PII filter is planned for v2. **Users building consumer-facing applications must apply additional PII handling.** |
| - **Copyright.** Sources are public web documents. Somali news sites are the largest contributors via HPLT/CC100. Users should consider downstream licensing obligations for their specific use case. |
| - **Bias.** The corpus inherits any biases of the upstream crawls — the Somali internet skews toward diaspora, news, politics, and religion. Under-represented registers include conversational speech, technical writing, and long-form fiction. |
|
|
| ## Usage |
|
|
| ### Load with `datasets` |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset("khaledyusuf44/somaliweb-v1") |
| print(ds) |
| # DatasetDict({'train': Dataset(num_rows=778355), 'validation': Dataset(num_rows=40967)}) |
| |
| sample = ds["train"][0] |
| # {'id': 'hplt2-so_12345', 'text': '...', 'source': 'hplt2-so', ...} |
| ``` |
|
|
| ### Load the companion tokenizer |
|
|
| ```python |
| from tokenizers import Tokenizer |
| tok = Tokenizer.from_file("tokenizer_somaliweb.json") |
| print(tok.encode("Soomaaliya waa dal ku yaal geeska Afrika.").ids) |
| ``` |
|
|
| ### Intended uses |
|
|
| - Somali LLM pretraining (the primary use case). |
| - Somali tokenizer training and evaluation. |
| - Low-resource NLP research. |
| - Somali downstream task fine-tuning (classification, NER, translation) — as a base for domain adaptation. |
|
|
| ### Out-of-scope uses |
|
|
| - **Consumer-facing applications without additional PII filtering.** |
| - **Claims of representing all Somali dialects.** This corpus is Standard Somali only. |
| - **Evaluation tasks that require contamination control.** Source documents predate construction and may overlap with FLORES-200 or other public Somali evaluation sets. We recommend a contamination audit before using this corpus to train models you intend to evaluate on those benchmarks. |
|
|
| ## Dataset Curators |
|
|
| Khalid Yusuf Dahir (`khaledyusuf44` on GitHub and Hugging Face). |
|
|
| ## Licensing |
|
|
| Released under **CC-BY-SA 4.0**, inheriting the most restrictive license among the upstream sources: |
|
|
| - HPLT v2: CC0 (permissive). |
| - CC100: public domain / MIT-like (permissive). |
| - Somali Wikipedia: CC-BY-SA 3.0 (requires attribution + share-alike). |
|
|
| Users of SomaliWeb v1 must honor CC-BY-SA 4.0 (attribution + share-alike). Citations appreciated. |
|
|
| ## Citation |
|
|
| If you use SomaliWeb v1, the matched tokenizer, the LID benchmark, or the construction pipeline, please cite the companion paper: |
|
|
| ```bibtex |
| @article{dahir2026somaliweb, |
| title = {SomaliWeb v1: A Quality-Filtered Somali Web Corpus with a Matched Tokenizer and a Public Language-Identification Benchmark}, |
| author = {Dahir, Khalid Yusuf}, |
| year = {2026}, |
| eprint = {2605.18232}, |
| archivePrefix = {arXiv}, |
| primaryClass = {cs.CL}, |
| url = {https://arxiv.org/abs/2605.18232} |
| } |
| ``` |
|
|
| ## Acknowledgments |
|
|
| This dataset builds on: |
|
|
| - **HPLT v2** (University of Helsinki / Turku / Edinburgh consortium) — the primary CC-derived source. |
| - **CC100** (Wenzek et al., 2020) — the secondary CC-derived source distributed via statmt.org. |
| - **Somali Wikipedia** contributors — the clean anchor and quality-filter seed. |
| - **Common Crawl** — the underlying web archive all three upstream corpora were built from. |
| - **FLORES-200** (NLLB Team et al., 2022) — held-out evaluation set. |
| - **GlotLID** (Kargaran et al., 2023) — dialect tagging. |
|
|
| ## Changelog |
|
|
| - **v1.0** (2026-04-23): Initial release. |
| - **v1.0.1** (2026-05-19): Added arXiv:2605.18232 paper citation and reference. |
|
|