Vasily Alexeev commited on
Commit
ca195ec
·
1 Parent(s): 74a71cc

add info about full preproc

Browse files
Files changed (2) hide show
  1. README.md +136 -35
  2. SHA256SUMS +5 -0
README.md CHANGED
@@ -26,6 +26,20 @@ text, wikitext, direct categories, community quality status and revision links,
26
  and adds a `topics` list. The `topics` configuration supplies the complete subject
27
  definitions. The full category catalog remains in the source collection.
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ## Selection and subject labels
30
 
31
  The source includes namespace-0 articles with active recommended (Добротные),
@@ -62,7 +76,7 @@ research train/test split. The `corpus` split is a storage partition. Source tex
62
  has not been shortened or rewritten for subject selection. No exact duplicate source text was
63
  removed. This collection is not a representative sample of Russian writing.
64
 
65
- ## Loading
66
 
67
  The `articles` configuration is the default. `articles` and `topics` use
68
  compressed JSON Lines and the `corpus` split, with no dataset script.
@@ -80,8 +94,7 @@ print(len(articles)) # 17251
80
  print(len(topics)) # 28
81
  ```
82
 
83
- From a downloaded repository, use its local directory with the same two config
84
- names, or load the files directly:
85
 
86
  ```python
87
  articles = load_dataset(
@@ -121,6 +134,31 @@ bow = load_dataset(
121
  )
122
  ```
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  The NLP preparation section describes the normalized namespaces and text fields.
125
 
126
  The sidecar [data/labels.json](data/labels.json) is a JSON object mapping every
@@ -244,18 +282,10 @@ Counts overlap because an article may have several subjects.
244
 
245
 
246
  The source is the [Russian Wikipedia 20261001 dump](https://dumps.wikimedia.org/ruwiki/20261001/).
247
- The exact source files are listed below with their SHA-256 digests. Dump mirrors
248
- may later remove this dated snapshot; the filenames and digests identify the
249
- inputs independently of their continued availability.
250
-
251
- | File | SHA-256 |
252
- | --- | --- |
253
- | `ruwiki-20261001-page.sql.gz` | `24250cca6122fff02896a1ced0a85b7afa4d6be00fa119c169a5eeef3fbe5830` |
254
- | `ruwiki-20261001-page_props.sql.gz` | `fc9d5aeaf3487d932b82d18a16bc96f0e4e4702e1149cbbdc482eb509f6deb60` |
255
- | `ruwiki-20261001-categorylinks.sql.gz` | `1ecb32ffaff28a120b6a8f4297d4b228b65c49beb593eae022b5811ae41512e1` |
256
- | `ruwiki-20261001-linktarget.sql.gz` | `bc1f24b7b8eb06298cbe70fdfb010ec023586d05bd2d3403ba2370091e1edc4a` |
257
- | `ruwiki-20261001-pages-articles-multistream.xml.bz2` | `c22b6441176d2bc572ed6883abc6292fe168efca211f6cdd61d8772a78492a1b` |
258
- | `ruwiki-20261001-pages-articles-multistream-index.txt.bz2` | `17c6a4cebb90ecb2b0f881e04aa3b49356bd6ee6add802a7201b9ca1a9b093e3` |
259
 
260
  SQL provides selection, titles, page properties and category relationships. XML
261
  provides article content, `revision_id` and `revision_timestamp`. In the 17,413-article source collection, **11 articles**
@@ -275,18 +305,37 @@ can inspect these losses or apply a different extraction procedure. Neither
275
 
276
  The [standalone preparation code](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2/tree/main/preprocessing)
277
  and [full instructions](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2#nlp-preparation)
278
- are maintained in the source collection. Download the code directory and use
279
- `--dataset selected` to prepare this collection, or `--dataset both` to prepare
280
- both collections from their pinned sources. Build and verify require Python
281
- 3.11.15; verify needs no NLP packages.
 
 
 
 
282
 
283
  ```bash
284
- python prepare.py --action download --dataset selected --sources-dir ./sources
285
- python prepare.py --action build --dataset selected --sources-dir ./sources --output-dir ./output --scratch-dir ./scratch
286
- python prepare.py --action verify --dataset selected --sources-dir ./sources --output-dir ./output
 
 
 
287
  ```
288
 
289
- The workflow produces `output/selected/noow.csv` and `bow.csv` with exactly
 
 
 
 
 
 
 
 
 
 
 
 
290
  `id`, `raw_text`, `vw_text` columns for all 17,251 selected IDs, preserving article
291
  order. CSV `raw_text` is the title, two LF characters and the original readable
292
  body with its leading CR/LF characters removed. Original JSON `raw_text` remains
@@ -321,13 +370,63 @@ Load a generated CSV directly:
321
 
322
  ```python
323
  noow = load_dataset(
324
- "csv", data_files={"corpus": "output/selected/noow.csv"}, split="corpus"
325
  )
326
  bow = load_dataset(
327
- "csv", data_files={"corpus": "output/selected/bow.csv"}, split="corpus"
328
  )
329
  ```
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  Preparation code is MIT licensed in the source collection. Article text and its
332
  normalized derivatives retain the CC BY-SA 4.0 terms and attribution obligations
333
  below.
@@ -356,15 +455,17 @@ offensive material. The partial subject labels described here do not establish a
356
  annotation. Further downstream preprocessing, deduplication policy and research
357
  splits must be specified separately.
358
 
359
- ## Published file identity
360
 
361
- | File | Bytes | SHA-256 |
362
- | --- | ---: | --- |
363
- | `data/articles.jsonl.gz` | 413,342,335 | `9eb7efffe99fc7c9bc3f4b3eb9f0378d91f387081f97cf9abea9c1686797c1ed` |
364
- | `data/topics.jsonl.gz` | 2,671 | `c8cf602a924f18255e155cdcaa9357907461851e849113c72051c2b89484f22c` |
365
- | `data/noow.csv` | 1,118,455,706 | `2c71aa6b5a327ebe924f5f0160eaf6f923a86da1a3a7fe8c68aa67f8858f8b6b` |
366
- | `data/bow.csv` | 875,143,956 | `bff3a82c29ab3b866fe86135ff99b3897deb98dc4e5ed6db4ea7b24bd4011bae` |
367
- | `data/labels.json` | 649,823 | `e7ceacd69d76601df24bb42e6d0177f46142d0b8ac1bf6e8c22ad4d5a0b0ca70` |
368
 
369
- The source article payload SHA-256 is
370
- `c51f9b6bee4c85f25ffb861060f52490a9276bae289d2aa2db7e0d10e2dda950`.
 
 
 
 
 
26
  and adds a `topics` list. The `topics` configuration supplies the complete subject
27
  definitions. The full category catalog remains in the source collection.
28
 
29
+ ## Files at a glance
30
+
31
+ | File | Purpose | Bytes |
32
+ | --- | --- | ---: |
33
+ | `data/articles.jsonl.gz` | Source articles with retained subject labels. | 413,342,335 |
34
+ | `data/topics.jsonl.gz` | The 28 subject definitions and their boundaries. | 2,671 |
35
+ | `data/labels.json` | Article-ID to subject-slug mapping for replay and analysis. | 649,823 |
36
+ | `data/noow.csv` | Whole-document text and ordered normalized VW features. | 1,118,455,706 |
37
+ | `data/bow.csv` | The same documents with counted VW features. | 875,143,956 |
38
+
39
+ [SHA256SUMS](SHA256SUMS) covers this repository's published data. Preparation code,
40
+ environment locks and source/output pins are maintained once in the
41
+ [Full collection](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2/tree/main/preprocessing).
42
+
43
  ## Selection and subject labels
44
 
45
  The source includes namespace-0 articles with active recommended (Добротные),
 
76
  has not been shortened or rewritten for subject selection. No exact duplicate source text was
77
  removed. This collection is not a representative sample of Russian writing.
78
 
79
+ ## Quick start: load the published files
80
 
81
  The `articles` configuration is the default. `articles` and `topics` use
82
  compressed JSON Lines and the `corpus` split, with no dataset script.
 
94
  print(len(topics)) # 28
95
  ```
96
 
97
+ From a downloaded repository, load the JSON Lines files directly:
 
98
 
99
  ```python
100
  articles = load_dataset(
 
134
  )
135
  ```
136
 
137
+ CSV is the primary prepared format. The explicit `"csv"` builder above is
138
+ required: these files are not additional YAML configurations, because combining
139
+ JSON and CSV builders in one repository configuration did not load reliably.
140
+ The published CSV files have been fully read with Hugging Face Datasets.
141
+
142
+ To export one VW document per line without loading the CSV into memory, run this
143
+ from the downloaded repository. Choose an output path outside the repository:
144
+
145
+ ```python
146
+ import csv
147
+ from pathlib import Path
148
+
149
+ csv.field_size_limit(2**31 - 1)
150
+ with Path("data/noow.csv").open(encoding="utf-8", newline="") as source:
151
+ with Path("../RuWiki-Good-2026-V2-Selected-noow.vw").open("w", encoding="utf-8", newline="") as output:
152
+ for row in csv.DictReader(source):
153
+ output.write(row["vw_text"] + "\n")
154
+ ```
155
+
156
+ The field-size setting is needed only for Python's standard `csv` reader;
157
+ it does not configure Hugging Face Datasets. Use `bow.csv` in the same example
158
+ for counted features. CSV records contain whole documents and may include
159
+ embedded newlines in `raw_text`, so splitting the CSV by physical lines is unsafe.
160
+ The repository does not store a second permanent copy as VW text files.
161
+
162
  The NLP preparation section describes the normalized namespaces and text fields.
163
 
164
  The sidecar [data/labels.json](data/labels.json) is a JSON object mapping every
 
282
 
283
 
284
  The source is the [Russian Wikipedia 20261001 dump](https://dumps.wikimedia.org/ruwiki/20261001/).
285
+ The [source and output pins](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2/blob/main/preprocessing/wikipedia-quality-corpus-20261001.json) record the names, byte sizes and SHA-256 digests of all six
286
+ inputs: page, page properties, category links and link targets SQL dumps, plus the
287
+ multistream article XML and its index. Dump mirrors may later remove this dated
288
+ snapshot; the pins identify the inputs independently of their availability.
 
 
 
 
 
 
 
 
289
 
290
  SQL provides selection, titles, page properties and category relationships. XML
291
  provides article content, `revision_id` and `revision_timestamp`. In the 17,413-article source collection, **11 articles**
 
305
 
306
  The [standalone preparation code](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2/tree/main/preprocessing)
307
  and [full instructions](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2#nlp-preparation)
308
+ are maintained in Full. Install that directory's locked Linux x86-64 environment
309
+ before running the commands below from the parent of both downloaded repository
310
+ directories. Working files go under a separate `ruwiki-rebuild` directory; choose
311
+ fresh output and scratch paths on a disk with enough space. Corpus output and
312
+ scratch inside a published clone are rejected. Build and
313
+ verify require Python 3.11.15 because VW escaping depends on its Unicode database;
314
+ verify needs no NLP packages. `requirements.txt` includes `mwparserfromhell==0.7.2`
315
+ for corpus extraction; the existing environment locks also remain available.
316
 
317
  ```bash
318
+ conda create --name ruwiki-nlp --file RuWiki-Good-2026-V2/preprocessing/conda-linux-64.lock.txt
319
+ conda activate ruwiki-nlp
320
+ python -m pip install -r RuWiki-Good-2026-V2/preprocessing/pip-linux-x86_64.lock.txt
321
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action download --dataset selected --sources-dir ./ruwiki-rebuild/nlp-sources
322
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action build --dataset selected --sources-dir ./ruwiki-rebuild/nlp-sources --output-dir ./ruwiki-rebuild/nlp-output --scratch-dir ./ruwiki-rebuild/nlp-scratch
323
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action verify --dataset selected --sources-dir ./ruwiki-rebuild/nlp-sources --output-dir ./ruwiki-rebuild/nlp-output
324
  ```
325
 
326
+ `--stage nlp` is the default; commands without it continue to work. Use
327
+ `--dataset both` to prepare both collections. Download checks pinned source
328
+ snapshots and supplies the pinned NLTK stopwords archive. Build runs offline.
329
+ Keep output and scratch separate from published `data/` and use fresh directories
330
+ for a new build. Full's instructions explain reuse of local JSONL files and
331
+ access to restricted source repositories.
332
+
333
+ After the structural NLP checks, the shared entry point independently compares
334
+ CSV and Selected label byte sizes and SHA-256 hashes with published expectations
335
+ in the corpus contract, reporting `PUBLISHED_NLP_OK`. It does not rely on the
336
+ new build manifest as its authority and does not replay NLP normalization.
337
+
338
+ The workflow produces `./ruwiki-rebuild/nlp-output/selected/noow.csv` and `bow.csv` with exactly
339
  `id`, `raw_text`, `vw_text` columns for all 17,251 selected IDs, preserving article
340
  order. CSV `raw_text` is the title, two LF characters and the original readable
341
  body with its leading CR/LF characters removed. Original JSON `raw_text` remains
 
370
 
371
  ```python
372
  noow = load_dataset(
373
+ "csv", data_files={"corpus": "./ruwiki-rebuild/nlp-output/selected/noow.csv"}, split="corpus"
374
  )
375
  bow = load_dataset(
376
+ "csv", data_files={"corpus": "./ruwiki-rebuild/nlp-output/selected/bow.csv"}, split="corpus"
377
  )
378
  ```
379
 
380
+ A measured NLP build of **both Full and Selected** from ready JSONL snapshots took
381
+ 42 min 5.83 s, with 10.58 GiB peak resident memory, approximately 3.74 GiB of final
382
+ output and 0.53 GiB of scratch. These are measurements from one environment,
383
+ not Selected-only estimates or measurements of replay from raw Wikimedia dumps.
384
+
385
+ ## Rebuild Selected from source data
386
+
387
+ Full's [corpus replay instructions](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2#rebuild-the-corpus-from-wikimedia-dumps)
388
+ cover the six pinned 20261001 dumps, explicit download resumption with `--resume`,
389
+ offline construction and independent published-payload verification. The shared
390
+ [source and output contract](https://huggingface.co/datasets/TopicNet/RuWiki-Good-2026-V2/blob/main/preprocessing/wikipedia-quality-corpus-20261001.json)
391
+ contains source dump and annotation pins. The new public path from raw dumps has
392
+ **not yet been run end to end**; its runtime and resource requirements remain
393
+ unmeasured.
394
+
395
+ For the complete path, run from the parent of both downloaded repository
396
+ directories, as in the NLP commands above:
397
+
398
+ ```bash
399
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action download --dataset both --sources-dir ./ruwiki-rebuild/dump-sources
400
+ # Add --resume explicitly when continuing an interrupted download.
401
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action build --dataset both --sources-dir ./ruwiki-rebuild/dump-sources --annotations-dir RuWiki-Good-2026-V2-Selected/data --output-dir ./ruwiki-rebuild/corpus-output --scratch-dir ./ruwiki-rebuild/corpus-scratch
402
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action verify --dataset both --sources-dir ./ruwiki-rebuild/dump-sources --output-dir ./ruwiki-rebuild/corpus-output
403
+ ```
404
+
405
+ This writes `./ruwiki-rebuild/corpus-output/full/articles.jsonl.gz` and `categories.jsonl.gz`,
406
+ plus `./ruwiki-rebuild/corpus-output/selected/articles.jsonl.gz` and `topics.jsonl.gz`. The
407
+ annotation directory must already contain this collection's `labels.json` and
408
+ `topics.jsonl.gz`. Reconstruction retains the published mapping and does not
409
+ rerun AI annotation or establish new evidence for label correctness.
410
+
411
+ If a previously accepted Full corpus is already available, build only Selected
412
+ without rereading the dumps:
413
+
414
+ ```bash
415
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action build --dataset selected --sources-dir RuWiki-Good-2026-V2/data --full-dir RuWiki-Good-2026-V2/data --annotations-dir RuWiki-Good-2026-V2-Selected/data --output-dir ./ruwiki-rebuild/selected-output --scratch-dir ./ruwiki-rebuild/selected-scratch
416
+ python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action verify --dataset selected --sources-dir RuWiki-Good-2026-V2/data --output-dir ./ruwiki-rebuild/selected-output
417
+ ```
418
+
419
+ This Selected-only workflow has been verified byte for byte against the published
420
+ archive of all 17,251 articles, the labels file and the topic definitions.
421
+
422
+ Use fresh output and scratch directories. Corpus verification checks exact
423
+ compressed output bytes against the separately bundled published payload pins;
424
+ it does not treat a newly generated manifest as independent evidence. To prepare
425
+ NLP CSVs from `./ruwiki-rebuild/corpus-output`, run the earlier NLP commands with
426
+ `--sources-dir ./ruwiki-rebuild/corpus-output` and fresh `--output-dir ./ruwiki-rebuild/replay-nlp-output` and
427
+ `--scratch-dir ./ruwiki-rebuild/replay-nlp-scratch`. Run NLP download first to supply NLTK
428
+ stopwords, then offline build and verify.
429
+
430
  Preparation code is MIT licensed in the source collection. Article text and its
431
  normalized derivatives retain the CC BY-SA 4.0 terms and attribution obligations
432
  below.
 
455
  annotation. Further downstream preprocessing, deduplication policy and research
456
  splits must be specified separately.
457
 
458
+ ## File verification
459
 
460
+ Run from this downloaded repository's root:
461
+
462
+ ```bash
463
+ sha256sum -c SHA256SUMS
464
+ ```
 
 
465
 
466
+ [SHA256SUMS](SHA256SUMS) covers all five data files, excluding this README and
467
+ Git/service metadata. Full has its own manifest for its data and shared
468
+ preparation files. The shared corpus contract independently pins expected
469
+ published reconstruction payloads. A successful local checksum check establishes
470
+ agreement with the supplied manifest; use a trusted repository revision to
471
+ establish provenance.
SHA256SUMS ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ 9eb7efffe99fc7c9bc3f4b3eb9f0378d91f387081f97cf9abea9c1686797c1ed data/articles.jsonl.gz
2
+ bff3a82c29ab3b866fe86135ff99b3897deb98dc4e5ed6db4ea7b24bd4011bae data/bow.csv
3
+ e7ceacd69d76601df24bb42e6d0177f46142d0b8ac1bf6e8c22ad4d5a0b0ca70 data/labels.json
4
+ 2c71aa6b5a327ebe924f5f0160eaf6f923a86da1a3a7fe8c68aa67f8858f8b6b data/noow.csv
5
+ c8cf602a924f18255e155cdcaa9357907461851e849113c72051c2b89484f22c data/topics.jsonl.gz