Datasets:
1000_novels: drop the Wolne Lektury footer path, pin the screen CSV (888 -> 887 texts)
Browse filesMaintainer decision: a Wolne Lektury public-domain footer no longer keeps a
row. 1000_novels_0734 (translator "A.L.", not identified) fails closed as
unresolved. Screen totals: pd_by_term 887, in_copyright 18, unresolved 95.
clean_1000_novels.py pins the screen CSV by SHA-256 (7fefc75f...) and exits on
a mismatch; the same value is in license-evidence.json, and a contract test
checks that the two match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- artifacts/source_findings.md +7 -0
- data/1000_novels/1000_novels.attribution.jsonl +2 -2
- data/1000_novels/1000_novels.license-evidence.json +4 -4
- data/1000_novels/1000_novels.md +10 -11
- data/1000_novels/1000_novels.parquet +2 -2
- data/1000_novels/1000_novels.stats.json +10 -11
- src/clean_1000_novels.py +10 -3
- src/sources.py +2 -4
- src/test_1000_novels_contract.py +19 -4
artifacts/source_findings.md
CHANGED
|
@@ -1361,3 +1361,10 @@ and 94 unresolved. Tracks slayerlabs/polish-dynaword-v2#44.
|
|
| 1361 |
|
| 1362 |
**Lesson:** a Wolne Lektury public-domain footer is a claim, not evidence. One of the
|
| 1363 |
12 it covered had a translator who died in 1960.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1361 |
|
| 1362 |
**Lesson:** a Wolne Lektury public-domain footer is a claim, not evidence. One of the
|
| 1363 |
12 it covered had a translator who died in 1960.
|
| 1364 |
+
|
| 1365 |
+
**Update (2026-10-06, maintainer decision):** the screen no longer keeps a row on a
|
| 1366 |
+
Wolne Lektury public-domain footer. "A. L." (`1000_novels_0734`) now fails closed as
|
| 1367 |
+
unresolved, so the release keeps 887 texts and drops 18 in copyright and 95 unresolved.
|
| 1368 |
+
`src/clean_1000_novels.py` pins the screen CSV by SHA-256
|
| 1369 |
+
(`7fefc75f8fcbd07e5ec98842276765ffef9520b6acb4e24b4751c67cc3d2081c`, also in
|
| 1370 |
+
`1000_novels.license-evidence.json`).
|
data/1000_novels/1000_novels.attribution.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ca43c45683ca0ba08aeda5d9f1089c3ca699450e2fca25ff972736f2024f603
|
| 3 |
+
size 323093
|
data/1000_novels/1000_novels.license-evidence.json
CHANGED
|
@@ -4,16 +4,16 @@
|
|
| 4 |
"upstream_record_license": "CC BY 4.0, stated on a metadata-only record (read 2026-09-30); it does not license the texts",
|
| 5 |
"upstream_rights_statement": "CLARIN-PL (Tomasz Naskręt), email reply received 2026-10-05: the handle currently contains metadata only and does not provide the corpus files for download or redistribution; CLARIN-PL does not distribute the individual novels or translations and does not hold documentation concerning the rights to the individual texts.",
|
| 6 |
"text_license": "public-domain",
|
| 7 |
-
"test": "Polish law (Art. 36): the author and every credited translator died in 1955 or earlier; an author or credited name without a curated death year fails closed (anonymous works excepted), and a credited translator who died after 1955 makes the text in copyright. Translator death years added 2026-10-06 cite Biblioteka Narodowa / VIAF authority records in the screen script.
|
| 8 |
"not_assessed": "Edition and critical-edition rights (Art. 99^1-99^2).",
|
| 9 |
"screen": "polish-dynaword-v2/evidence/1000_novels_rights_screen.csv",
|
| 10 |
"screen_script": "polish-dynaword-v2/scripts/novels_rights_screen.py",
|
|
|
|
| 11 |
"release_scope": {
|
| 12 |
"screened": 1000,
|
| 13 |
-
"kept":
|
| 14 |
"pd_by_term": 887,
|
| 15 |
-
"pd_per_wolne_lektury": 1,
|
| 16 |
"dropped_in_copyright": 18,
|
| 17 |
-
"dropped_unresolved":
|
| 18 |
}
|
| 19 |
}
|
|
|
|
| 4 |
"upstream_record_license": "CC BY 4.0, stated on a metadata-only record (read 2026-09-30); it does not license the texts",
|
| 5 |
"upstream_rights_statement": "CLARIN-PL (Tomasz Naskręt), email reply received 2026-10-05: the handle currently contains metadata only and does not provide the corpus files for download or redistribution; CLARIN-PL does not distribute the individual novels or translations and does not hold documentation concerning the rights to the individual texts.",
|
| 6 |
"text_license": "public-domain",
|
| 7 |
+
"test": "Polish law (Art. 36): the author and every credited translator died in 1955 or earlier; an author or credited name without a curated death year fails closed (anonymous works excepted), and a credited translator who died after 1955 makes the text in copyright. Translator death years added 2026-10-06 cite Biblioteka Narodowa / VIAF authority records in the screen script. A Wolne Lektury public-domain footer does not substitute for a death year: 1000_novels_0734 (translator \"A.L.\", not identified) is dropped as unresolved, and 1 row (1000_novels_0462, co-translator Stefan Frycz d. 1960) is dropped against its Wolne Lektury public-domain footer.",
|
| 8 |
"not_assessed": "Edition and critical-edition rights (Art. 99^1-99^2).",
|
| 9 |
"screen": "polish-dynaword-v2/evidence/1000_novels_rights_screen.csv",
|
| 10 |
"screen_script": "polish-dynaword-v2/scripts/novels_rights_screen.py",
|
| 11 |
+
"screen_sha256": "7fefc75f8fcbd07e5ec98842276765ffef9520b6acb4e24b4751c67cc3d2081c",
|
| 12 |
"release_scope": {
|
| 13 |
"screened": 1000,
|
| 14 |
+
"kept": 887,
|
| 15 |
"pd_by_term": 887,
|
|
|
|
| 16 |
"dropped_in_copyright": 18,
|
| 17 |
+
"dropped_unresolved": 95
|
| 18 |
}
|
| 19 |
}
|
data/1000_novels/1000_novels.md
CHANGED
|
@@ -22,45 +22,44 @@ script `polish-dynaword-v2/scripts/novels_rights_screen.py`):
|
|
| 22 |
| status | texts | released |
|
| 23 |
|---|---:|---|
|
| 24 |
| public domain by term: the author and every credited translator died in 1955 or earlier (Art. 36) | 887 | yes |
|
| 25 |
-
| marked public domain by Wolne Lektury in the retained footer | 1 | yes |
|
| 26 |
| in copyright: 17 published by Wolne Lektury under CC BY-SA 3.0, 1 with a translator who died in 1960 | 18 | no |
|
| 27 |
-
| author or translator not verified, or the text does not match its file |
|
| 28 |
|
| 29 |
Translator death years added on 2026-10-06 cite Biblioteka Narodowa and VIAF authority
|
| 30 |
records, listed in the screen script. They identify the cryptonym "A. W." on 29 Chekhov
|
| 31 |
texts as Antoni Lange (d. 1929). They also show that *Wola mocy* (`1000_novels_0462`) was
|
| 32 |
co-translated by Stefan Frycz (d. 1960), so it is dropped although its Wolne Lektury footer
|
| 33 |
-
says public domain.
|
| 34 |
-
"A.
|
| 35 |
-
verified. Edition and critical-edition rights (Art. 99¹–99²) are not assessed.
|
| 36 |
|
| 37 |
## Attribution
|
| 38 |
The `author` column credits the author and, for translations, the translator:
|
| 39 |
`Hans Christian Andersen (tłum. Cecylia Niewiadomska)`. `1000_novels.attribution.jsonl`
|
| 40 |
has, per row: author, author's death year, translator, title, how the title was read
|
| 41 |
-
(`file`: header text matching the CLARIN file name,
|
| 42 |
author line, 32; `manual`: read by hand, 17), CLARIN file name, screen status and basis.
|
| 43 |
|
| 44 |
## Provenance
|
| 45 |
Pulled from SpeakLeash's public redistribution (`speakleash-ds-pub`, key
|
| 46 |
`1000_novels_corpus_CLARIN-PL`) of the CLARIN-PL corpus; row *i* matches the *i*-th file
|
| 47 |
of the CLARIN listing. Rebuilt by `src/clean_1000_novels.py` from the v0.2.5 Parquet
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
## Statistics
|
| 51 |
| documents | characters | tokens (tiktoken proxy) |
|
| 52 |
|---:|---:|---:|
|
| 53 |
-
|
|
| 54 |
|
| 55 |
## Per-document license metadata
|
| 56 |
| license | documents |
|
| 57 |
|---|---:|
|
| 58 |
-
| `public-domain` |
|
| 59 |
|
| 60 |
-
Author metadata present for **
|
| 61 |
|
| 62 |
## Filters applied
|
| 63 |
-
- rights screen: read 1,000 → kept
|
| 64 |
- no length, language, deduplication or OCR filters in this rebuild
|
| 65 |
|
| 66 |
Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
|
|
|
|
| 22 |
| status | texts | released |
|
| 23 |
|---|---:|---|
|
| 24 |
| public domain by term: the author and every credited translator died in 1955 or earlier (Art. 36) | 887 | yes |
|
|
|
|
| 25 |
| in copyright: 17 published by Wolne Lektury under CC BY-SA 3.0, 1 with a translator who died in 1960 | 18 | no |
|
| 26 |
+
| author or translator not verified, or the text does not match its file | 95 | no |
|
| 27 |
|
| 28 |
Translator death years added on 2026-10-06 cite Biblioteka Narodowa and VIAF authority
|
| 29 |
records, listed in the screen script. They identify the cryptonym "A. W." on 29 Chekhov
|
| 30 |
texts as Antoni Lange (d. 1929). They also show that *Wola mocy* (`1000_novels_0462`) was
|
| 31 |
co-translated by Stefan Frycz (d. 1960), so it is dropped although its Wolne Lektury footer
|
| 32 |
+
says public domain. A Wolne Lektury public-domain footer alone does not clear a text:
|
| 33 |
+
`1000_novels_0734` (translator "A.L.", not identified) is dropped as unresolved. Edition and critical-edition rights (Art. 99¹–99²) are not assessed.
|
|
|
|
| 34 |
|
| 35 |
## Attribution
|
| 36 |
The `author` column credits the author and, for translations, the translator:
|
| 37 |
`Hans Christian Andersen (tłum. Cecylia Niewiadomska)`. `1000_novels.attribution.jsonl`
|
| 38 |
has, per row: author, author's death year, translator, title, how the title was read
|
| 39 |
+
(`file`: header text matching the CLARIN file name, 838; `position`: the line beside the
|
| 40 |
author line, 32; `manual`: read by hand, 17), CLARIN file name, screen status and basis.
|
| 41 |
|
| 42 |
## Provenance
|
| 43 |
Pulled from SpeakLeash's public redistribution (`speakleash-ds-pub`, key
|
| 44 |
`1000_novels_corpus_CLARIN-PL`) of the CLARIN-PL corpus; row *i* matches the *i*-th file
|
| 45 |
of the CLARIN listing. Rebuilt by `src/clean_1000_novels.py` from the v0.2.5 Parquet
|
| 46 |
+
and the screen CSV, both pinned by SHA-256 in the script. Text, `added`, `created` and
|
| 47 |
+
`token_count` are unchanged.
|
| 48 |
|
| 49 |
## Statistics
|
| 50 |
| documents | characters | tokens (tiktoken proxy) |
|
| 51 |
|---:|---:|---:|
|
| 52 |
+
| 887 | 130,201,301 | 51,981,548 |
|
| 53 |
|
| 54 |
## Per-document license metadata
|
| 55 |
| license | documents |
|
| 56 |
|---|---:|
|
| 57 |
+
| `public-domain` | 887 |
|
| 58 |
|
| 59 |
+
Author metadata present for **887** documents.
|
| 60 |
|
| 61 |
## Filters applied
|
| 62 |
+
- rights screen: read 1,000 → kept 887 (dropped 18 in copyright, 95 unresolved)
|
| 63 |
- no length, language, deduplication or OCR filters in this rebuild
|
| 64 |
|
| 65 |
Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
|
data/1000_novels/1000_novels.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d568499837a4c2518396849462e16a2203996e077c7d551c0e17cda6f69fd82
|
| 3 |
+
size 63324274
|
data/1000_novels/1000_novels.stats.json
CHANGED
|
@@ -1,29 +1,28 @@
|
|
| 1 |
{
|
| 2 |
"read": 1000,
|
| 3 |
-
"kept":
|
| 4 |
-
"drop_rights":
|
| 5 |
"drop_short": 0,
|
| 6 |
"drop_lang": 0,
|
| 7 |
"drop_dup": 0,
|
| 8 |
"drop_ocr": 0,
|
| 9 |
-
"chars":
|
| 10 |
-
"tokens":
|
| 11 |
"licenses": {
|
| 12 |
-
"public-domain":
|
| 13 |
},
|
| 14 |
-
"authors_with_value":
|
| 15 |
"license": "public-domain",
|
| 16 |
"screen": {
|
| 17 |
"pd_by_term": 887,
|
| 18 |
-
"unresolved":
|
| 19 |
-
"in_copyright": 18
|
| 20 |
-
"pd_per_wolne_lektury": 1
|
| 21 |
},
|
| 22 |
"titles": {
|
| 23 |
-
"file":
|
| 24 |
"position": 32,
|
| 25 |
"manual": 17
|
| 26 |
},
|
| 27 |
"input_sha256": "27be09e5e2347dcf1a83e94b6c210ca26bdd89365bc3563e88ea5af9846990ea",
|
| 28 |
-
"screen_sha256": "
|
| 29 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"read": 1000,
|
| 3 |
+
"kept": 887,
|
| 4 |
+
"drop_rights": 113,
|
| 5 |
"drop_short": 0,
|
| 6 |
"drop_lang": 0,
|
| 7 |
"drop_dup": 0,
|
| 8 |
"drop_ocr": 0,
|
| 9 |
+
"chars": 130201301,
|
| 10 |
+
"tokens": 51981548,
|
| 11 |
"licenses": {
|
| 12 |
+
"public-domain": 887
|
| 13 |
},
|
| 14 |
+
"authors_with_value": 887,
|
| 15 |
"license": "public-domain",
|
| 16 |
"screen": {
|
| 17 |
"pd_by_term": 887,
|
| 18 |
+
"unresolved": 95,
|
| 19 |
+
"in_copyright": 18
|
|
|
|
| 20 |
},
|
| 21 |
"titles": {
|
| 22 |
+
"file": 838,
|
| 23 |
"position": 32,
|
| 24 |
"manual": 17
|
| 25 |
},
|
| 26 |
"input_sha256": "27be09e5e2347dcf1a83e94b6c210ca26bdd89365bc3563e88ea5af9846990ea",
|
| 27 |
+
"screen_sha256": "7fefc75f8fcbd07e5ec98842276765ffef9520b6acb4e24b4751c67cc3d2081c"
|
| 28 |
}
|
src/clean_1000_novels.py
CHANGED
|
@@ -9,7 +9,8 @@ kept only when the per-text rights screen finds it public domain in Poland:
|
|
| 9 |
Kept rows are labelled `public-domain`, and `author` credits the author and any translator.
|
| 10 |
Title, death year, screen basis and CLARIN file name go to `1000_novels.attribution.jsonl`.
|
| 11 |
|
| 12 |
-
The input is the v0.2.5 Parquet, pinned by SHA-256. Restore
|
|
|
|
| 13 |
git checkout v0.2.5 -- data/1000_novels/1000_novels.parquet
|
| 14 |
python3 src/clean_1000_novels.py --screen ../polish-dynaword-v2/evidence/1000_novels_rights_screen.csv
|
| 15 |
"""
|
|
@@ -31,9 +32,11 @@ SOURCE = "1000_novels"
|
|
| 31 |
ROOT = Path(__file__).resolve().parents[1]
|
| 32 |
DATA = ROOT / "data" / SOURCE
|
| 33 |
INPUT_SHA256 = "27be09e5e2347dcf1a83e94b6c210ca26bdd89365bc3563e88ea5af9846990ea" # v0.2.5
|
|
|
|
|
|
|
| 34 |
UPSTREAM = "https://clarin-pl.eu/dspace/handle/11321/312"
|
| 35 |
LICENSE = "public-domain"
|
| 36 |
-
KEEP = {"pd_by_term"
|
| 37 |
SCREENS = KEEP | {"in_copyright", "unresolved"}
|
| 38 |
# Read off each text's header by hand where the rules below fail: no header, a dedication
|
| 39 |
# ("H. K. T."), a series title (Proust), a title broken over lines, or a misspelt file name.
|
|
@@ -133,6 +136,10 @@ def credit(author: str, translator: str) -> str:
|
|
| 133 |
|
| 134 |
|
| 135 |
def build(input_path: Path, screen_path: Path, out_dir: Path) -> dict:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
if sha256(input_path) != INPUT_SHA256:
|
| 137 |
raise SystemExit(f"{input_path} is not the v0.2.5 Parquet; restore it with "
|
| 138 |
"`git checkout v0.2.5 -- data/1000_novels/1000_novels.parquet`")
|
|
@@ -168,7 +175,7 @@ def build(input_path: Path, screen_path: Path, out_dir: Path) -> dict:
|
|
| 168 |
"licenses": {LICENSE: len(kept)}, "authors_with_value": sum(bool(r["author"]) for r in kept),
|
| 169 |
"license": LICENSE, "screen": dict(Counter(r["screen"] for r in screen.values())),
|
| 170 |
"titles": dict(Counter(a["title_from"] for a in attribution)),
|
| 171 |
-
"input_sha256": INPUT_SHA256, "screen_sha256":
|
| 172 |
}
|
| 173 |
staged = {
|
| 174 |
out_dir / f"{SOURCE}.parquet.tmp": lambda p: pq.write_table(
|
|
|
|
| 9 |
Kept rows are labelled `public-domain`, and `author` credits the author and any translator.
|
| 10 |
Title, death year, screen basis and CLARIN file name go to `1000_novels.attribution.jsonl`.
|
| 11 |
|
| 12 |
+
The input is the v0.2.5 Parquet and the screen CSV, both pinned by SHA-256. Restore the Parquet
|
| 13 |
+
before a rerun:
|
| 14 |
git checkout v0.2.5 -- data/1000_novels/1000_novels.parquet
|
| 15 |
python3 src/clean_1000_novels.py --screen ../polish-dynaword-v2/evidence/1000_novels_rights_screen.csv
|
| 16 |
"""
|
|
|
|
| 32 |
ROOT = Path(__file__).resolve().parents[1]
|
| 33 |
DATA = ROOT / "data" / SOURCE
|
| 34 |
INPUT_SHA256 = "27be09e5e2347dcf1a83e94b6c210ca26bdd89365bc3563e88ea5af9846990ea" # v0.2.5
|
| 35 |
+
# polish-dynaword-v2 evidence/1000_novels_rights_screen.csv for v0.2.6; also in 1000_novels.license-evidence.json
|
| 36 |
+
SCREEN_SHA256 = "7fefc75f8fcbd07e5ec98842276765ffef9520b6acb4e24b4751c67cc3d2081c"
|
| 37 |
UPSTREAM = "https://clarin-pl.eu/dspace/handle/11321/312"
|
| 38 |
LICENSE = "public-domain"
|
| 39 |
+
KEEP = {"pd_by_term"}
|
| 40 |
SCREENS = KEEP | {"in_copyright", "unresolved"}
|
| 41 |
# Read off each text's header by hand where the rules below fail: no header, a dedication
|
| 42 |
# ("H. K. T."), a series title (Proust), a title broken over lines, or a misspelt file name.
|
|
|
|
| 136 |
|
| 137 |
|
| 138 |
def build(input_path: Path, screen_path: Path, out_dir: Path) -> dict:
|
| 139 |
+
if (found := sha256(screen_path)) != SCREEN_SHA256:
|
| 140 |
+
raise SystemExit(f"{screen_path} is not the pinned rights screen: SHA-256 {found}, expected "
|
| 141 |
+
f"{SCREEN_SHA256}; regenerate it with polish-dynaword-v2/scripts/novels_rights_screen.py "
|
| 142 |
+
"or update SCREEN_SHA256 and 1000_novels.license-evidence.json together")
|
| 143 |
if sha256(input_path) != INPUT_SHA256:
|
| 144 |
raise SystemExit(f"{input_path} is not the v0.2.5 Parquet; restore it with "
|
| 145 |
"`git checkout v0.2.5 -- data/1000_novels/1000_novels.parquet`")
|
|
|
|
| 175 |
"licenses": {LICENSE: len(kept)}, "authors_with_value": sum(bool(r["author"]) for r in kept),
|
| 176 |
"license": LICENSE, "screen": dict(Counter(r["screen"] for r in screen.values())),
|
| 177 |
"titles": dict(Counter(a["title_from"] for a in attribution)),
|
| 178 |
+
"input_sha256": INPUT_SHA256, "screen_sha256": SCREEN_SHA256,
|
| 179 |
}
|
| 180 |
staged = {
|
| 181 |
out_dir / f"{SOURCE}.parquet.tmp": lambda p: pq.write_table(
|
src/sources.py
CHANGED
|
@@ -697,13 +697,11 @@ SOURCES = {
|
|
| 697 |
"Reduced by src/clean_1000_novels.py to the public-domain texts of the "
|
| 698 |
"per-text rights screen; text unchanged.",
|
| 699 |
"legal_note": "Public domain in Poland only (Art. 36, life + 70); status in other "
|
| 700 |
-
"jurisdictions not assessed.
|
| 701 |
-
"public-domain footer. Edition rights (Art. 99^1-99^2) not assessed.",
|
| 702 |
"license": "public-domain",
|
| 703 |
"license_spdx": "LicenseRef-Public-Domain-PL",
|
| 704 |
"traceable": "Only texts in the public domain in Poland are kept: the author and "
|
| 705 |
-
"every credited translator died in 1955 or earlier (Art. 36)
|
| 706 |
-
"retained Wolne Lektury footer states no economic copyright. Per-text "
|
| 707 |
"screen: polish-dynaword-v2/evidence/1000_novels_rights_screen.csv; "
|
| 708 |
"author, translator, title and basis per row in "
|
| 709 |
"1000_novels.attribution.jsonl. The CLARIN-PL CC BY 4.0 record covers "
|
|
|
|
| 697 |
"Reduced by src/clean_1000_novels.py to the public-domain texts of the "
|
| 698 |
"per-text rights screen; text unchanged.",
|
| 699 |
"legal_note": "Public domain in Poland only (Art. 36, life + 70); status in other "
|
| 700 |
+
"jurisdictions not assessed. Edition rights (Art. 99^1-99^2) not assessed.",
|
|
|
|
| 701 |
"license": "public-domain",
|
| 702 |
"license_spdx": "LicenseRef-Public-Domain-PL",
|
| 703 |
"traceable": "Only texts in the public domain in Poland are kept: the author and "
|
| 704 |
+
"every credited translator died in 1955 or earlier (Art. 36). Per-text "
|
|
|
|
| 705 |
"screen: polish-dynaword-v2/evidence/1000_novels_rights_screen.csv; "
|
| 706 |
"author, translator, title and basis per row in "
|
| 707 |
"1000_novels.attribution.jsonl. The CLARIN-PL CC BY 4.0 record covers "
|
src/test_1000_novels_contract.py
CHANGED
|
@@ -4,8 +4,9 @@ import json
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import pyarrow.parquet as pq
|
|
|
|
| 7 |
|
| 8 |
-
from clean_1000_novels import credit, file_slug, title_of
|
| 9 |
|
| 10 |
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
DATA = ROOT / "data" / "1000_novels"
|
|
@@ -17,14 +18,14 @@ def test_schema_counts_and_attribution():
|
|
| 17 |
rows = table.select(["id", "source", "license", "author"]).to_pylist()
|
| 18 |
sidecar = [json.loads(line) for line in (DATA / "1000_novels.attribution.jsonl").read_text(encoding="utf-8").splitlines()]
|
| 19 |
assert table.column_names == ["id", "text", "source", "added", "created", "token_count", "license", "author"]
|
| 20 |
-
assert table.num_rows == stats["kept"] == len(sidecar) == stats["screen"]["pd_by_term"]
|
|
|
|
| 21 |
assert len({r["id"] for r in rows}) == table.num_rows
|
| 22 |
assert {r["source"] for r in rows} == {"1000_novels"}
|
| 23 |
assert {r["license"] for r in rows} == {a["license"] for a in sidecar} == {"public-domain"}
|
| 24 |
-
assert {a["screen"] for a in sidecar}
|
| 25 |
scope = json.loads((DATA / "1000_novels.license-evidence.json").read_text(encoding="utf-8"))["release_scope"]
|
| 26 |
assert scope == {"screened": stats["read"], "kept": stats["kept"], "pd_by_term": stats["screen"]["pd_by_term"],
|
| 27 |
-
"pd_per_wolne_lektury": stats["screen"]["pd_per_wolne_lektury"],
|
| 28 |
"dropped_in_copyright": stats["screen"]["in_copyright"], "dropped_unresolved": stats["screen"]["unresolved"]}
|
| 29 |
by_id = {a["id"]: a for a in sidecar}
|
| 30 |
assert by_id.keys() == {r["id"] for r in rows}
|
|
@@ -35,6 +36,20 @@ def test_schema_counts_and_attribution():
|
|
| 35 |
assert bool(a["title"]) == (a["title_from"] != "none")
|
| 36 |
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
def test_title_rules():
|
| 39 |
assert file_slug("sienkiewicz_krzyzacy_tom-II_1900.txt") == "krzyzacy-tom-ii"
|
| 40 |
assert title_of("Henryk Sienkiewicz\nKrzyżacy\nTom II\n", "sienkiewicz_krzyzacy_tom-II_1900.txt", "Henryk Sienkiewicz") == ("Krzyżacy Tom II", "file")
|
|
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import pyarrow.parquet as pq
|
| 7 |
+
import pytest
|
| 8 |
|
| 9 |
+
from clean_1000_novels import SCREEN_SHA256, build, credit, file_slug, title_of
|
| 10 |
|
| 11 |
ROOT = Path(__file__).resolve().parents[1]
|
| 12 |
DATA = ROOT / "data" / "1000_novels"
|
|
|
|
| 18 |
rows = table.select(["id", "source", "license", "author"]).to_pylist()
|
| 19 |
sidecar = [json.loads(line) for line in (DATA / "1000_novels.attribution.jsonl").read_text(encoding="utf-8").splitlines()]
|
| 20 |
assert table.column_names == ["id", "text", "source", "added", "created", "token_count", "license", "author"]
|
| 21 |
+
assert table.num_rows == stats["kept"] == len(sidecar) == stats["screen"]["pd_by_term"]
|
| 22 |
+
assert stats["screen"].keys() <= {"pd_by_term", "in_copyright", "unresolved"}
|
| 23 |
assert len({r["id"] for r in rows}) == table.num_rows
|
| 24 |
assert {r["source"] for r in rows} == {"1000_novels"}
|
| 25 |
assert {r["license"] for r in rows} == {a["license"] for a in sidecar} == {"public-domain"}
|
| 26 |
+
assert {a["screen"] for a in sidecar} == {"pd_by_term"}
|
| 27 |
scope = json.loads((DATA / "1000_novels.license-evidence.json").read_text(encoding="utf-8"))["release_scope"]
|
| 28 |
assert scope == {"screened": stats["read"], "kept": stats["kept"], "pd_by_term": stats["screen"]["pd_by_term"],
|
|
|
|
| 29 |
"dropped_in_copyright": stats["screen"]["in_copyright"], "dropped_unresolved": stats["screen"]["unresolved"]}
|
| 30 |
by_id = {a["id"]: a for a in sidecar}
|
| 31 |
assert by_id.keys() == {r["id"] for r in rows}
|
|
|
|
| 36 |
assert bool(a["title"]) == (a["title_from"] != "none")
|
| 37 |
|
| 38 |
|
| 39 |
+
|
| 40 |
+
def test_screen_pin_matches_license_evidence_and_stats():
|
| 41 |
+
evidence = json.loads((DATA / "1000_novels.license-evidence.json").read_text(encoding="utf-8"))
|
| 42 |
+
stats = json.loads((DATA / "1000_novels.stats.json").read_text(encoding="utf-8"))
|
| 43 |
+
assert SCREEN_SHA256 == evidence["screen_sha256"] == stats["screen_sha256"]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def test_build_rejects_an_unpinned_screen(tmp_path):
|
| 47 |
+
screen = tmp_path / "screen.csv"
|
| 48 |
+
screen.write_text("id,screen\n1000_novels_0001,pd_by_term\n", encoding="utf-8")
|
| 49 |
+
with pytest.raises(SystemExit, match="not the pinned rights screen"):
|
| 50 |
+
build(tmp_path / "unused.parquet", screen, tmp_path)
|
| 51 |
+
assert list(tmp_path.iterdir()) == [screen]
|
| 52 |
+
|
| 53 |
def test_title_rules():
|
| 54 |
assert file_slug("sienkiewicz_krzyzacy_tom-II_1900.txt") == "krzyzacy-tom-ii"
|
| 55 |
assert title_of("Henryk Sienkiewicz\nKrzyżacy\nTom II\n", "sienkiewicz_krzyzacy_tom-II_1900.txt", "Henryk Sienkiewicz") == ("Krzyżacy Tom II", "file")
|