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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
language:
|
| 4 |
+
- so
|
| 5 |
+
size_categories:
|
| 6 |
+
- 100K<n<1M
|
| 7 |
+
task_categories:
|
| 8 |
+
- text-generation
|
| 9 |
+
- fill-mask
|
| 10 |
+
pretty_name: SomaliWeb v1
|
| 11 |
+
configs:
|
| 12 |
+
- config_name: default
|
| 13 |
+
data_files:
|
| 14 |
+
- split: train
|
| 15 |
+
path: train.jsonl
|
| 16 |
+
- split: validation
|
| 17 |
+
path: validation.jsonl
|
| 18 |
+
tags:
|
| 19 |
+
- somali
|
| 20 |
+
- low-resource
|
| 21 |
+
- pretraining
|
| 22 |
+
- web-corpus
|
| 23 |
+
- deduplicated
|
| 24 |
+
- quality-filtered
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# SomaliWeb v1 — Quality-filtered Somali web corpus
|
| 28 |
+
|
| 29 |
+
**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.
|
| 30 |
+
|
| 31 |
+
This is, to our knowledge, the first dedicated and versioned Somali-only pretraining corpus released on Hugging Face with a complete dataset card.
|
| 32 |
+
|
| 33 |
+
## Dataset summary
|
| 34 |
+
|
| 35 |
+
- **Language**: Somali (Standard Somali, Latin script). No Maay Maay detected in the final distribution.
|
| 36 |
+
- **Token count**: ~303M approximate tokens (`words × 1.3`), **233M whitespace-separated words**.
|
| 37 |
+
- **Document count**: 819,322 (train: 778,355 · validation: 40,967, 95/5 split).
|
| 38 |
+
- **Script**: Latin.
|
| 39 |
+
- **Period of source content**: ~2019–2024, inherited from HPLT v2 and CC100.
|
| 40 |
+
- **License**: CC-BY-SA 4.0 (see Licensing below; sources have compatible terms).
|
| 41 |
+
|
| 42 |
+
## Why this dataset
|
| 43 |
+
|
| 44 |
+
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:
|
| 45 |
+
|
| 46 |
+
- A reproducible pipeline anyone can re-run and audit.
|
| 47 |
+
- A comparison baseline tokenizer trained on HPLT-raw, released alongside.
|
| 48 |
+
- An evaluation against FLORES-200 Somali showing measurable fertility improvements over general-purpose tokenizers.
|
| 49 |
+
|
| 50 |
+
## Dataset structure
|
| 51 |
+
|
| 52 |
+
### Data fields
|
| 53 |
+
|
| 54 |
+
Each line in `train.jsonl` and `validation.jsonl` is one JSON object:
|
| 55 |
+
|
| 56 |
+
- `id` (string): source-prefixed unique identifier (e.g. `hplt2-so_12345`).
|
| 57 |
+
- `text` (string): the document body, cleaned and length-filtered.
|
| 58 |
+
- `source` (string): one of `hplt2-so`, `cc100-so`, `wikipedia-so`.
|
| 59 |
+
- `n_words` (int): whitespace-separated word count after cleaning.
|
| 60 |
+
- `quality_score` (float): Phase-5 quality score (0–1, higher = cleaner Somali).
|
| 61 |
+
- `lang_conf` (float): langdetect top-1 confidence for Somali.
|
| 62 |
+
- `dialect_tag` (string, optional): GlotLID v3 dialect tag (almost always `som_Latn`).
|
| 63 |
+
|
| 64 |
+
### Data splits
|
| 65 |
+
|
| 66 |
+
| Split | Documents | Approx tokens |
|
| 67 |
+
|---|---:|---:|
|
| 68 |
+
| `train` (95%) | 778,355 | ~288M |
|
| 69 |
+
| `validation` (5%) | 40,967 | ~15M |
|
| 70 |
+
|
| 71 |
+
### Source composition (of the combined train + validation)
|
| 72 |
+
|
| 73 |
+
| Source | Documents | Fraction |
|
| 74 |
+
|---|---:|---:|
|
| 75 |
+
| HPLT v2 `som_Latn` | 582,257 | 71.07% |
|
| 76 |
+
| CC100-so (statmt.org) | 233,394 | 28.49% |
|
| 77 |
+
| Somali Wikipedia (dump 2023-11-01) | 3,671 | 0.45% |
|
| 78 |
+
|
| 79 |
+
## Construction pipeline
|
| 80 |
+
|
| 81 |
+
Full details + intermediate metrics in the companion GitHub repository's `reports/` directory. The pipeline is six phases:
|
| 82 |
+
|
| 83 |
+
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.
|
| 84 |
+
|
| 85 |
+
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.
|
| 86 |
+
|
| 87 |
+
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%.
|
| 88 |
+
|
| 89 |
+
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.
|
| 90 |
+
|
| 91 |
+
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.
|
| 92 |
+
|
| 93 |
+
6. **Release structuring.** Shuffled (seed 0), 95/5 train/val split, metadata consolidated.
|
| 94 |
+
|
| 95 |
+
## Evaluation
|
| 96 |
+
|
| 97 |
+
### Tokenizer fertility on FLORES-200 Somali devtest (1,012 held-out sentences)
|
| 98 |
+
|
| 99 |
+
| Tokenizer | Training corpus | Vocab | Tokens | Fertility ↓ |
|
| 100 |
+
|---|---|---:|---:|---:|
|
| 101 |
+
| **SomaliWeb-v1** (this dataset) | 350M tokens (cleaned) | 16K | 35,867 | **1.538** |
|
| 102 |
+
| HPLT-raw | 505M tokens (raw HPLT v2) | 16K | 35,854 | 1.537 |
|
| 103 |
+
| GPT-4 `cl100k_base` | proprietary | 100K | 60,010 | 2.573 |
|
| 104 |
+
|
| 105 |
+
**Two results:**
|
| 106 |
+
|
| 107 |
+
- SomaliWeb v1 matches HPLT-raw's tokenizer fertility at 30% smaller training corpus — our dedup + quality filter preserves tokenizer quality.
|
| 108 |
+
- 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.
|
| 109 |
+
|
| 110 |
+
The companion tokenizer is published alongside as `tokenizer_somaliweb.json` (HF tokenizers JSON format).
|
| 111 |
+
|
| 112 |
+
## Limitations and considerations
|
| 113 |
+
|
| 114 |
+
- **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.
|
| 115 |
+
- **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.
|
| 116 |
+
- **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.
|
| 117 |
+
- **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.
|
| 118 |
+
- **Dialect scope.** Standard Somali only.
|
| 119 |
+
- **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.**
|
| 120 |
+
- **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.
|
| 121 |
+
- **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.
|
| 122 |
+
|
| 123 |
+
## Usage
|
| 124 |
+
|
| 125 |
+
### Load with `datasets`
|
| 126 |
+
|
| 127 |
+
```python
|
| 128 |
+
from datasets import load_dataset
|
| 129 |
+
|
| 130 |
+
ds = load_dataset("khaledyusuf44/somaliweb-v1")
|
| 131 |
+
print(ds)
|
| 132 |
+
# DatasetDict({'train': Dataset(num_rows=778355), 'validation': Dataset(num_rows=40967)})
|
| 133 |
+
|
| 134 |
+
sample = ds["train"][0]
|
| 135 |
+
# {'id': 'hplt2-so_12345', 'text': '...', 'source': 'hplt2-so', ...}
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Load the companion tokenizer
|
| 139 |
+
|
| 140 |
+
```python
|
| 141 |
+
from tokenizers import Tokenizer
|
| 142 |
+
tok = Tokenizer.from_file("tokenizer_somaliweb.json")
|
| 143 |
+
print(tok.encode("Soomaaliya waa dal ku yaal geeska Afrika.").ids)
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
### Intended uses
|
| 147 |
+
|
| 148 |
+
- Somali LLM pretraining (the primary use case).
|
| 149 |
+
- Somali tokenizer training and evaluation.
|
| 150 |
+
- Low-resource NLP research.
|
| 151 |
+
- Somali downstream task fine-tuning (classification, NER, translation) — as a base for domain adaptation.
|
| 152 |
+
|
| 153 |
+
### Out-of-scope uses
|
| 154 |
+
|
| 155 |
+
- **Consumer-facing applications without additional PII filtering.**
|
| 156 |
+
- **Claims of representing all Somali dialects.** This corpus is Standard Somali only.
|
| 157 |
+
- **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.
|
| 158 |
+
|
| 159 |
+
## Dataset Curators
|
| 160 |
+
|
| 161 |
+
Khalid Yusuf Dahir (`khaledyusuf44` on GitHub and Hugging Face).
|
| 162 |
+
|
| 163 |
+
## Licensing
|
| 164 |
+
|
| 165 |
+
Released under **CC-BY-SA 4.0**, inheriting the most restrictive license among the upstream sources:
|
| 166 |
+
|
| 167 |
+
- HPLT v2: CC0 (permissive).
|
| 168 |
+
- CC100: public domain / MIT-like (permissive).
|
| 169 |
+
- Somali Wikipedia: CC-BY-SA 3.0 (requires attribution + share-alike).
|
| 170 |
+
|
| 171 |
+
Users of SomaliWeb v1 must honor CC-BY-SA 4.0 (attribution + share-alike). Citations appreciated.
|
| 172 |
+
|
| 173 |
+
## Citation
|
| 174 |
+
|
| 175 |
+
```bibtex
|
| 176 |
+
@misc{somaliweb2026,
|
| 177 |
+
title = {SomaliWeb v1: A quality-filtered Somali web corpus},
|
| 178 |
+
author = {Khalid Yusuf Dahir},
|
| 179 |
+
year = {2026},
|
| 180 |
+
howpublished = {\url{https://huggingface.co/datasets/khaledyusuf44/somaliweb-v1}},
|
| 181 |
+
}
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
## Acknowledgments
|
| 185 |
+
|
| 186 |
+
This dataset builds on:
|
| 187 |
+
|
| 188 |
+
- **HPLT v2** (University of Helsinki / Turku / Edinburgh consortium) — the primary CC-derived source.
|
| 189 |
+
- **CC100** (Wenzek et al., 2020) — the secondary CC-derived source distributed via statmt.org.
|
| 190 |
+
- **Somali Wikipedia** contributors — the clean anchor and quality-filter seed.
|
| 191 |
+
- **Common Crawl** — the underlying web archive all three upstream corpora were built from.
|
| 192 |
+
- **FLORES-200** (NLLB Team et al., 2022) — held-out evaluation set.
|
| 193 |
+
- **GlotLID** (Kargaran et al., 2023) — dialect tagging.
|
| 194 |
+
|
| 195 |
+
## Changelog
|
| 196 |
+
|
| 197 |
+
- **v1.0** (2026-04-23): Initial release.
|