File size: 8,135 Bytes
3f61d08 0e4015e 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 efaeed7 3f61d08 efaeed7 3f61d08 4da0b86 3f61d08 fa53b40 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 4da0b86 3f61d08 0e4015e 3f61d08 0e4015e 3f61d08 0e4015e 3f61d08 4da0b86 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | ---
language:
- en
license: unknown
task_categories:
- text-classification
tags:
- topic-modeling
- topic-modelling
- text-clustering
- document-representation
size_categories:
- 1K<n<10K
configs:
- config_name: noow
default: true
data_files:
- split: corpus
path: data/noow.csv
- config_name: bow
data_files:
- split: corpus
path: data/bow.csv
---
# BBC-News
This TopicNet preparation contains 2,085 retained BBC news bodies with five original directory labels, derived from the source release of 2,225 articles from 2004–2005.
## Population, labels and splits
Raw duplicate identity is body text after casefold and whitespace collapse. Same-label duplicates retain the lexicographically smallest ID; cross-label conflicts would be quarantined. There are 137 raw duplicate groups and three identical lemma-sequence groups; 140 documents are removed and none quarantined. Fourteen near-duplicate pairs join families without removing their members.
Family groups combine raw/lemma duplicate relations, source URL/DOI relations where present, and body five-token shingle Jaccard similarity ≥0.9. Groups are assigned by iterative multilabel stratification with seeds 20260824 and 20260825; all retained members of a group stay together. The resulting disjoint, exhaustive research splits are **fit 1,250, calibration 419, validation 416**. The Hugging Face split `corpus` contains every retained document; it is not `fit`.
Retained class counts:
| Label | Documents |
| --- | ---: |
| business | 500 |
| entertainment | 366 |
| politics | 394 |
| sport | 491 |
| tech | 334 |
## Representations and preprocessing
The source adapter separates the original headline from the body at the first blank line. IDs are `bbc_<directory-label>_<three-digit-file-stem>`.
Each UTF-8 CSV has exactly `id,raw_text,vw_text` columns and lexicographically ordered document IDs. `raw_text` contains the original, unnormalized headline followed by a blank line (two LF characters) and the original body. Only leading CR and LF characters are removed from the body at this boundary; all other headline and body characters are preserved. The VW string starts with the document ID followed by `|@title` then `|@word`: `@title` contains normalized original headline tokens, and `@word` contains normalized body tokens only. Normalizing the complete `raw_text` therefore does not reproduce the existing features in each modality. Labels are separate from the VW string. `noow` preserves normalized token occurrences in order; `bow` counts the same tokens independently per namespace as `token:count`, with lexicographic token order. The full prepared token sequences are included.
NOOW means occurrence order after preprocessing, not untouched or reversible prose. English preprocessing uses Python 3.11.15, NLTK 3.9.2 and NLTK-data commit `550b6625bcef1f2abff2ff770a5a0d272c9c6b2a`: WordPunctTokenizer, lowercase per original span, minimum token length 2, averaged_perceptron_tagger_eng, WordNet POS mapping J/V/N/R with noun fallback, English stopword removal and `lemma.isalpha()` filtering. Names are not masked.
## Reproduce from source
The shared standalone code is in the [SciNews preprocessing folder](https://huggingface.co/datasets/TopicNet/SciNews/tree/main/preprocessing). Follow its [setup and code-download instructions](https://huggingface.co/datasets/TopicNet/SciNews/blob/main/preprocessing/README.md) to download only that folder at a full commit revision and create the locked Linux x86-64 environment with Python 3.11.15. Access follows the SciNews repository's permissions. No parent project checkout, BigARTM or TopicNet installation is needed.
From the directory containing the downloaded `preprocessing/` folder, choose writable source storage and fresh output and scratch paths:
```bash
python preprocessing/prepare.py download --dataset bbc-news --sources-dir /path/to/sources
python preprocessing/prepare.py build --dataset bbc-news \
--sources-dir /path/to/sources \
--output-dir /path/to/rebuilt/BBC-News/data \
--scratch-dir /path/to/scratch/bbc-news
python preprocessing/prepare.py verify --dataset bbc-news \
--data-dir /path/to/rebuilt/BBC-News/data
```
The download provides the pinned `bbc-news/bbc-fulltext.zip` and NLTK resources under the source directory. Build and verify run offline after setup. The output contains only `noow.csv`, `bow.csv`, `labels.json` and `splits.json`; verification compares them with the recorded SHA-256 values. Builds refuse to overwrite outputs. Preserve failed output and scratch files, and use fresh paths for a retry. The shared code's MIT license does not change the source-text rights below.
## Loading and metadata
The default configuration is `noow`; `bow` contains aggregated counts. Both expose the complete population as the Hugging Face split `corpus`. Labels and the stored fit/calibration/validation memberships are auxiliary files, joined by document ID. `data/labels.json` directly maps each string ID to a list of string labels; `data/splits.json` directly maps each split name to an ordered ID list.
```python
from datasets import load_dataset
repo = "TopicNet/BBC-News"
corpus = load_dataset(repo, "noow", split="corpus")
bow = load_dataset(repo, "bow", split="corpus")
```
For local use, obtain the complete package including actual Git LFS contents. Set `HF_DATASETS_OFFLINE=1` and `HF_HUB_OFFLINE=1` before Python starts and choose a writable cache directory:
```python
import json
from pathlib import Path
from datasets import load_dataset
package = Path("/path/to/BBC-News")
corpus = load_dataset(str(package), "noow", split="corpus",
cache_dir="/writable/cache")
bow = load_dataset(str(package), "bow", split="corpus",
cache_dir="/writable/cache")
with (package / "data/labels.json").open(encoding="utf-8") as handle:
labels = json.load(handle)
with (package / "data/splits.json").open(encoding="utf-8") as handle:
splits = json.load(handle)
membership = {doc_id: split for split, ids in splits.items() for doc_id in ids}
annotated = corpus.map(lambda row: {"labels": labels[row["id"]],
"research_split": membership[row["id"]]})
fit = annotated.filter(lambda row: row["research_split"] == "fit")
```
For remote metadata, download `data/labels.json` and `data/splits.json` with `huggingface_hub.hf_hub_download(repo, filename, repo_type="dataset")`, then read the same direct mappings. Private repositories require authorized authentication.
## Files and integrity
The package contains this card, `.gitattributes`, [SHA256SUMS](SHA256SUMS), two CSV representations and [labels](data/labels.json)/[splits](data/splits.json) metadata, plus the verbatim source README. Run `sha256sum -c SHA256SUMS` from the package root to check the listed files.
## Rights, limitations and citation
License: unknown. The [compiler's source page](https://derekgreene.com/bbc/) and [author's repository](https://github.com/derekgreene/bbc-datasets) describe the corpus and its non-commercial research condition. BBC holds copyright in the articles. The verbatim [SOURCE_README.txt](SOURCE_README.txt) retains the source notice. The [SetFit card](https://huggingface.co/datasets/SetFit/bbc-news/blob/main/README.md) has no license field and explicitly credits BBC copyright; that card does not supply redistribution permission. Redistribution rights remain unresolved.
Source selection, historical coverage, class imbalance and automatic preprocessing affect the labels and topic distributions. Family grouping reduces known duplicate leakage, but some semantic duplicates may remain. The articles may contain personal information and outdated claims. Assess the corpus's suitability for your application before relying on it for decisions.
Derek Greene and Pádraig Cunningham (2006), *Practical Solutions to the Problem of Diagonal Dominance in Kernel Document Clustering*, ICML.
When citing this preparation, identify its retained population and repository revision as well as the source publication.
|