Vasily Alexeev commited on
Commit
8447272
·
1 Parent(s): 55a54e6

refine datasets name usage in readme

Browse files
Files changed (1) hide show
  1. README.md +80 -36
README.md CHANGED
@@ -108,14 +108,14 @@ bow = load_dataset(
108
  )
109
  ```
110
 
111
- From the parent of a downloaded repository:
112
 
113
  ```python
114
  noow = load_dataset(
115
- "csv", data_files={"corpus": "RuWiki-Good-2026-V2/data/noow.csv"}, split="corpus"
116
  )
117
  bow = load_dataset(
118
- "csv", data_files={"corpus": "RuWiki-Good-2026-V2/data/bow.csv"}, split="corpus"
119
  )
120
  ```
121
 
@@ -133,7 +133,7 @@ from pathlib import Path
133
 
134
  csv.field_size_limit(2**31 - 1)
135
  with Path("data/noow.csv").open(encoding="utf-8", newline="") as source:
136
- with Path("../RuWiki-Good-2026-V2-noow.vw").open("w", encoding="utf-8", newline="") as output:
137
  for row in csv.DictReader(source):
138
  output.write(row["vw_text"] + "\n")
139
  ```
@@ -293,24 +293,40 @@ without information from held-out documents. For text-only experiments, use only
293
 
294
  ### Rebuild NLP CSVs from ready article snapshots
295
 
296
- Run from the parent directory containing the downloaded `RuWiki-Good-2026-V2`
297
- and `RuWiki-Good-2026-V2-Selected` repositories. Working files go under a separate
298
- `ruwiki-rebuild` directory. Choose fresh output and scratch paths on a disk with
299
- enough space; corpus output and scratch inside a published clone are rejected.
300
- Python 3.11.15 is the pinned
 
301
  runtime for both build and verify: VW escaping depends on its Unicode database.
302
  On Linux x86-64, use the supplied locks:
303
 
304
  ```bash
305
- conda create --name ruwiki-nlp --file RuWiki-Good-2026-V2/preprocessing/conda-linux-64.lock.txt
 
 
 
 
306
  conda activate ruwiki-nlp
307
- python -m pip install -r RuWiki-Good-2026-V2/preprocessing/pip-linux-x86_64.lock.txt
308
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --help
309
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action download --dataset both --sources-dir ./ruwiki-rebuild/nlp-sources
310
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action build --dataset both --sources-dir ./ruwiki-rebuild/nlp-sources --output-dir ./ruwiki-rebuild/nlp-output --scratch-dir ./ruwiki-rebuild/nlp-scratch
311
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action verify --dataset both --sources-dir ./ruwiki-rebuild/nlp-sources --output-dir ./ruwiki-rebuild/nlp-output
 
 
 
 
 
 
312
  ```
313
 
 
 
 
 
 
314
  `--stage nlp` is the default, so earlier commands without `--stage` continue to
315
  work. Choose `--dataset full`, `selected` or `both`. The
316
  [pinned NLP contract](preprocessing/wikipedia-quality-nlp-20261001.json) records
@@ -324,10 +340,10 @@ requirements in a separate environment, retain Python 3.11.15.
324
 
325
  Download checks existing source files against their pins, fetches missing files,
326
  and acquires the pinned NLTK archive at
327
- `./ruwiki-rebuild/nlp-sources/nltk_data/corpora/stopwords.zip`. To reuse downloaded JSONL files,
328
- place them at `./ruwiki-rebuild/nlp-sources/full/articles.jsonl.gz`,
329
- `./ruwiki-rebuild/nlp-sources/selected/articles.jsonl.gz` and
330
- `./ruwiki-rebuild/nlp-sources/selected/topics.jsonl.gz` before running download. This step creates
331
  the local NLTK resource directory; no pre-existing `nltk_data` is required.
332
  Use `--nltk-data` to select a different local NLTK resource directory.
333
 
@@ -335,7 +351,7 @@ Hugging Face downloads use anonymous Python `urllib`. For restricted repositorie
335
  fetch the pinned files with authenticated tools, place them at the paths above,
336
  and rerun download. The script does not handle authentication tokens.
337
  Build runs offline, checks runtime versions and Russian stopword content, and
338
- writes `./ruwiki-rebuild/nlp-output/full` and `./ruwiki-rebuild/nlp-output/selected`. Keep outputs and scratch
339
  separate from published data and use a fresh scratch directory for a new build.
340
  Progress messages identify phases and document counts. Each build manifest
341
  records counts and ordered IDs of documents with an empty `@word` namespace;
@@ -358,11 +374,16 @@ one environment, not a bound for other machines.
358
  Load a generated CSV directly:
359
 
360
  ```python
 
 
 
 
 
361
  noow = load_dataset(
362
- "csv", data_files={"corpus": "./ruwiki-rebuild/nlp-output/full/noow.csv"}, split="corpus"
363
  )
364
  bow = load_dataset(
365
- "csv", data_files={"corpus": "./ruwiki-rebuild/nlp-output/full/bow.csv"}, split="corpus"
366
  )
367
  ```
368
 
@@ -375,25 +396,34 @@ retained Selected annotations. This public raw-dump replay has **not yet been ru
375
  end to end**. Its download time, build time and peak disk and memory requirements
376
  have not been measured; the NLP measurements above do not describe this stage.
377
 
378
- The example below runs from the parent of both downloaded repository directories,
379
- as in the NLP commands above.
380
  The Selected annotation directory must already contain `labels.json` and
381
  `topics.jsonl.gz`. These retained mappings reproduce the published subject
382
  assignments; the script does not rerun AI labeling.
383
 
384
  ```bash
385
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action download --dataset both --sources-dir ./ruwiki-rebuild/dump-sources
 
386
  # Resume an interrupted dump download explicitly:
387
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage corpus --action download --dataset both --sources-dir ./ruwiki-rebuild/dump-sources --resume
388
- 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
389
- 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
 
 
 
 
 
 
 
 
390
  ```
391
 
392
  Download stores and checks the six pinned files beneath `--sources-dir`.
393
  After all files are present, build is offline. It reconstructs SQL metadata,
394
  selects qualifying article IDs, extracts the indexed XML revisions, and applies
395
- the readable-text cleanup. It writes `./ruwiki-rebuild/corpus-output/full/articles.jsonl.gz` and
396
- `categories.jsonl.gz`, plus `./ruwiki-rebuild/corpus-output/selected/articles.jsonl.gz` and
397
  `topics.jsonl.gz`. Use separate fresh output and scratch directories, leaving
398
  published `data/` untouched. Corpus verification compares outputs with the
399
  independently bundled expected published payloads, rather than trusting hashes
@@ -401,11 +431,19 @@ newly written by the build itself.
401
 
402
  For Full only, set `--dataset full` and omit `--annotations-dir`. Selected can
403
  also be reconstructed from a previously accepted Full corpus without rereading
404
- the dumps. From the same working directory:
405
 
406
  ```bash
407
- 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
408
- 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
 
 
 
 
 
 
 
 
409
  ```
410
 
411
  This Selected-only workflow has been verified byte for byte against the published
@@ -416,9 +454,15 @@ usable as `--sources-dir`. Download then supplies the pinned NLTK archive before
416
  the offline NLP build:
417
 
418
  ```bash
419
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action download --dataset both --sources-dir ./ruwiki-rebuild/corpus-output
420
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action build --dataset both --sources-dir ./ruwiki-rebuild/corpus-output --output-dir ./ruwiki-rebuild/replay-nlp-output --scratch-dir ./ruwiki-rebuild/replay-nlp-scratch
421
- python RuWiki-Good-2026-V2/preprocessing/prepare.py --stage nlp --action verify --dataset both --sources-dir ./ruwiki-rebuild/corpus-output --output-dir ./ruwiki-rebuild/replay-nlp-output
 
 
 
 
 
 
422
  ```
423
 
424
  The code in `preprocessing/` is available under its [MIT license](preprocessing/LICENSE).
 
108
  )
109
  ```
110
 
111
+ From the root of the downloaded repository:
112
 
113
  ```python
114
  noow = load_dataset(
115
+ "csv", data_files={"corpus": "data/noow.csv"}, split="corpus"
116
  )
117
  bow = load_dataset(
118
+ "csv", data_files={"corpus": "data/bow.csv"}, split="corpus"
119
  )
120
  ```
121
 
 
133
 
134
  csv.field_size_limit(2**31 - 1)
135
  with Path("data/noow.csv").open(encoding="utf-8", newline="") as source:
136
+ with Path("../noow.vw").open("w", encoding="utf-8", newline="") as output:
137
  for row in csv.DictReader(source):
138
  output.write(row["vw_text"] + "\n")
139
  ```
 
293
 
294
  ### Rebuild NLP CSVs from ready article snapshots
295
 
296
+ Run the preparation commands from `preprocessing/` in the downloaded Full
297
+ collection. Local repository directories may have any names. Replace the paths
298
+ below with your own absolute paths: `work_dir` is a separate working directory,
299
+ and `selected_data` points to the Selected collection's `data/` directory.
300
+ Choose fresh output and scratch paths on a disk with enough space; corpus output
301
+ and scratch inside a published clone are rejected. Python 3.11.15 is the pinned
302
  runtime for both build and verify: VW escaping depends on its Unicode database.
303
  On Linux x86-64, use the supplied locks:
304
 
305
  ```bash
306
+ cd "/absolute/path/to/full/preprocessing"
307
+ work_dir="/absolute/path/to/ruwiki-rebuild"
308
+ selected_data="/absolute/path/to/selected/data"
309
+
310
+ conda create --name ruwiki-nlp --file conda-linux-64.lock.txt
311
  conda activate ruwiki-nlp
312
+ python -m pip install -r pip-linux-x86_64.lock.txt
313
+ python prepare.py --help
314
+ python prepare.py --stage nlp --action download --dataset both \
315
+ --sources-dir "$work_dir/nlp-sources"
316
+ python prepare.py --stage nlp --action build --dataset both \
317
+ --sources-dir "$work_dir/nlp-sources" \
318
+ --output-dir "$work_dir/nlp-output" \
319
+ --scratch-dir "$work_dir/nlp-scratch"
320
+ python prepare.py --stage nlp --action verify --dataset both \
321
+ --sources-dir "$work_dir/nlp-sources" \
322
+ --output-dir "$work_dir/nlp-output"
323
  ```
324
 
325
+ Local paths above are independent of Hugging Face repository names. Online
326
+ loading examples and cross-repository links use the published Hugging Face IDs.
327
+ If those IDs change, the links and the downloader's pinned source addresses need
328
+ to be reviewed separately; renaming a local directory does not change them.
329
+
330
  `--stage nlp` is the default, so earlier commands without `--stage` continue to
331
  work. Choose `--dataset full`, `selected` or `both`. The
332
  [pinned NLP contract](preprocessing/wikipedia-quality-nlp-20261001.json) records
 
340
 
341
  Download checks existing source files against their pins, fetches missing files,
342
  and acquires the pinned NLTK archive at
343
+ `$work_dir/nlp-sources/nltk_data/corpora/stopwords.zip`. To reuse downloaded JSONL files,
344
+ place them at `$work_dir/nlp-sources/full/articles.jsonl.gz`,
345
+ `$work_dir/nlp-sources/selected/articles.jsonl.gz` and
346
+ `$work_dir/nlp-sources/selected/topics.jsonl.gz` before running download. This step creates
347
  the local NLTK resource directory; no pre-existing `nltk_data` is required.
348
  Use `--nltk-data` to select a different local NLTK resource directory.
349
 
 
351
  fetch the pinned files with authenticated tools, place them at the paths above,
352
  and rerun download. The script does not handle authentication tokens.
353
  Build runs offline, checks runtime versions and Russian stopword content, and
354
+ writes `$work_dir/nlp-output/full` and `$work_dir/nlp-output/selected`. Keep outputs and scratch
355
  separate from published data and use a fresh scratch directory for a new build.
356
  Progress messages identify phases and document counts. Each build manifest
357
  records counts and ordered IDs of documents with an empty `@word` namespace;
 
374
  Load a generated CSV directly:
375
 
376
  ```python
377
+ from pathlib import Path
378
+
379
+ # Use the same work directory as in the shell commands.
380
+ work_dir = Path("/absolute/path/to/ruwiki-rebuild")
381
+ output_dir = work_dir / "nlp-output/full"
382
  noow = load_dataset(
383
+ "csv", data_files={"corpus": str(output_dir / "noow.csv")}, split="corpus"
384
  )
385
  bow = load_dataset(
386
+ "csv", data_files={"corpus": str(output_dir / "bow.csv")}, split="corpus"
387
  )
388
  ```
389
 
 
396
  end to end**. Its download time, build time and peak disk and memory requirements
397
  have not been measured; the NLP measurements above do not describe this stage.
398
 
399
+ Keep the same `preprocessing/` working directory and path variables as in the
400
+ NLP commands above.
401
  The Selected annotation directory must already contain `labels.json` and
402
  `topics.jsonl.gz`. These retained mappings reproduce the published subject
403
  assignments; the script does not rerun AI labeling.
404
 
405
  ```bash
406
+ python prepare.py --stage corpus --action download --dataset both \
407
+ --sources-dir "$work_dir/dump-sources"
408
  # Resume an interrupted dump download explicitly:
409
+ python prepare.py --stage corpus --action download --dataset both \
410
+ --sources-dir "$work_dir/dump-sources" \
411
+ --resume
412
+ python prepare.py --stage corpus --action build --dataset both \
413
+ --sources-dir "$work_dir/dump-sources" \
414
+ --annotations-dir "$selected_data" \
415
+ --output-dir "$work_dir/corpus-output" \
416
+ --scratch-dir "$work_dir/corpus-scratch"
417
+ python prepare.py --stage corpus --action verify --dataset both \
418
+ --sources-dir "$work_dir/dump-sources" \
419
+ --output-dir "$work_dir/corpus-output"
420
  ```
421
 
422
  Download stores and checks the six pinned files beneath `--sources-dir`.
423
  After all files are present, build is offline. It reconstructs SQL metadata,
424
  selects qualifying article IDs, extracts the indexed XML revisions, and applies
425
+ the readable-text cleanup. It writes `$work_dir/corpus-output/full/articles.jsonl.gz` and
426
+ `categories.jsonl.gz`, plus `$work_dir/corpus-output/selected/articles.jsonl.gz` and
427
  `topics.jsonl.gz`. Use separate fresh output and scratch directories, leaving
428
  published `data/` untouched. Corpus verification compares outputs with the
429
  independently bundled expected published payloads, rather than trusting hashes
 
431
 
432
  For Full only, set `--dataset full` and omit `--annotations-dir`. Selected can
433
  also be reconstructed from a previously accepted Full corpus without rereading
434
+ the dumps. From the same `preprocessing/` directory, resolve Full's data path:
435
 
436
  ```bash
437
+ full_data="$(cd ../data && pwd -P)"
438
+ python prepare.py --stage corpus --action build --dataset selected \
439
+ --sources-dir "$full_data" \
440
+ --full-dir "$full_data" \
441
+ --annotations-dir "$selected_data" \
442
+ --output-dir "$work_dir/selected-output" \
443
+ --scratch-dir "$work_dir/selected-scratch"
444
+ python prepare.py --stage corpus --action verify --dataset selected \
445
+ --sources-dir "$full_data" \
446
+ --output-dir "$work_dir/selected-output"
447
  ```
448
 
449
  This Selected-only workflow has been verified byte for byte against the published
 
454
  the offline NLP build:
455
 
456
  ```bash
457
+ python prepare.py --stage nlp --action download --dataset both \
458
+ --sources-dir "$work_dir/corpus-output"
459
+ python prepare.py --stage nlp --action build --dataset both \
460
+ --sources-dir "$work_dir/corpus-output" \
461
+ --output-dir "$work_dir/replay-nlp-output" \
462
+ --scratch-dir "$work_dir/replay-nlp-scratch"
463
+ python prepare.py --stage nlp --action verify --dataset both \
464
+ --sources-dir "$work_dir/corpus-output" \
465
+ --output-dir "$work_dir/replay-nlp-output"
466
  ```
467
 
468
  The code in `preprocessing/` is available under its [MIT license](preprocessing/LICENSE).