Download README.md from TopicNet/BBC-News: direct link, hf CLI and curl.
- Browser
- Download file 8.14 kB
-
https://huggingface.co/datasets/TopicNet/BBC-News/resolve/main/README.md
- Command line
-
hf download hf://datasets/TopicNet/BBC-News/README.md
-
curl -L -o README.md https://huggingface.co/datasets/TopicNet/BBC-News/resolve/main/README.md
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. Follow its setup and code-download instructions 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:
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.
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:
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, two CSV representations and labels/splits 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 and author's repository describe the corpus and its non-commercial research condition. BBC holds copyright in the articles. The verbatim SOURCE_README.txt retains the source notice. The SetFit card 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.