wikibooks: label each page CC BY-SA 3.0 or 4.0 by its last revision, GFDL review (v0.2.6, v2#57)

#79
by ppuzio - opened
artifacts/source_findings.md CHANGED
@@ -1981,3 +1981,90 @@ Publications Office's position on non-Commission documents (lawyer question, #56
1981
 
1982
  **Lesson** — a reuse policy is not a Creative Commons licence: copy the clause, not the
1983
  label, and read what the grant covers before using its name.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1981
 
1982
  **Lesson** — a reuse policy is not a Creative Commons licence: copy the clause, not the
1983
  label, and read what the grant covers before using its name.
1984
+
1985
+ ## wikibooks — Polish Wikibooks (rebuild from the official dump, 3.0/4.0 labels, GFDL review)
1986
+
1987
+ **Investigated** — 2026-10-06 (October 2026 rights audit, `artifacts/rights_audit_2026-10/reports/wikis_ugc.md`,
1988
+ `reports/citations.md` L17-26; slayerlabs/polish-dynaword-v2#57).
1989
+
1990
+ **Verdict** — `kept`, relabelled; rebuilt from the official dump so the label follows the
1991
+ page's last revision. Documents, characters and tokens are unchanged from v0.2.5
1992
+ (9,112 / 38,892,589 / 15,571,295); the text multiset is identical. Labels per record:
1993
+ `CC-BY-SA-3.0` 4,461 documents (6,102,574 tokens, 39.2%), `CC-BY-SA-4.0` 4,651 (9,468,721,
1994
+ 60.8%); v0.2.5 labelled every row 3.0. Row ids are now `wikibooks_<page id>`
1995
+ ("Przewodnik po instalacji Debiana 3.0": `wikibooks_2419570` in v0.2.5, `wikibooks_1710` now);
1996
+ `author` is the page URL and `created` the last-revision date (v0.2.5: empty `author`, and
1997
+ the same range string "2004-01-01, 2025-12-31" as `created` on every row). The parquet
1998
+ `added` column is 2026-07-19 (v0.2.5: 2026-06-15).
1999
+
2000
+ **Enumeration** — `plwikibooks-20260601-pages-articles.xml.bz2` (sha1 `198ddcbe…` matched to
2001
+ the dump's `sha1sums.txt`), parsed by `src/fetch_wikimedia.py`: 34,967 pages → 12,838 in
2002
+ namespace 0 → 1,925 redirects, 1,247 pages under 200 characters and 23 exact duplicates
2003
+ skipped → 9,643 written → 531 non-Polish dropped by `build_dynaword.py` → 9,112. Text
2004
+ conversion is the v0.2.5 one (plain `strip_code`): `<ref>` bodies, `Kategoria:` links and
2005
+ `thumb|` file options stay in the text; nothing was changed in this PR. One sidecar line per
2006
+ row (`wikibooks.attribution.jsonl`).
2007
+
2008
+ **License evidence** — as for wikivoyage: Terms of Use oldid 554823 / 98524, the 3.0 and 4.0
2009
+ legal code, pl.wikibooks `rightsinfo` (BY-SA 4.0), read 2026-10-06. Cutoff 2023-06-07 00:00
2010
+ UTC; 2 documents were last edited that day. E1 (v2#56) is still pending.
2011
+
2012
+ **GFDL** — 435 documents (259,065 tokens, 1.7%) were last edited before 2009-06-15 (the
2013
+ start of CC BY-SA on the Wikimedia sites, per the audit); they carry `CC-BY-SA-3.0`, counted
2014
+ and not acted on. The audit's
2015
+ "24 GFDL-mentioning documents" cannot be reproduced (its pattern is not recorded; the closest,
2016
+ `\bFDL\b|Wolnej\s+Dokumentacji`, gives 25 documents / 69,072 tokens and neither document the
2017
+ audit names). A wider case-insensitive pattern matches 45 documents (122,192 tokens, 0.78%);
2018
+ all 45 were read and sorted in `data/wikibooks/wikibooks.gfdl-review.json`: 7 state that their
2019
+ own text is under the GNU FDL (42,834 tokens), 10 name a GFDL-licensed upstream work (6,903),
2020
+ 13 link the licence page only, 13 discuss licences, 2 match by accident. The largest is
2021
+ `wikibooks_30538` (35,619 tokens). No label and no drop follows from the review; the 17
2022
+ own-text and upstream documents (49,737 tokens) are the ones where a GFDL-only grant could
2023
+ matter, and keeping them is left to the maintainers and the lawyer.
2024
+
2025
+ **Blockers** — none to merge. Open: E1; the 17 documents above. Two pages seen during the
2026
+ review and not checked: `wikibooks_27716` (145 tokens) lists third-party course sources with
2027
+ their licences, among them CC-BY-NC 3.0 and "All Rights Reserved"; `wikibooks_27071` (1,287
2028
+ tokens) says it was moved in 2013 from the "Wolne podręczniki" portal with its creators'
2029
+ consent and does not state the original licence. The markup residue above also stays.
2030
+
2031
+ ## wikibooks — 46 pages withheld (update to the section above)
2032
+
2033
+ **Investigated** — 2026-10-06 (copyright sample and licence trace of the follow-up, then the
2034
+ maintainer's decision; slayerlabs/polish-dynaword-v2#57).
2035
+
2036
+ **Verdict** — `kept`, 46 pages withheld. Maintainer approval 2026-10-06, relayed by the
2037
+ coordinator. The numbers in the section above (9,112 documents, 38,892,589 characters,
2038
+ 15,571,295 tokens; 3.0: 4,461 / 6,102,574 tokens; 4.0: 4,651 / 9,468,721) are the v0.2.5 and
2039
+ pre-drop values; the release now holds 9,066 documents, 38,195,523 characters and 15,313,229
2040
+ tokens (3.0: 4,425 / 5,916,490; 4.0: 4,641 / 9,396,739). Withheld: 46 documents, 697,066
2041
+ characters, 258,066 tokens (36 labelled 3.0, 10 labelled 4.0).
2042
+
2043
+ **Withheld** — `wikibooks_23933` (Historia powszechna/Rzeczpospolita pod panowaniem królów
2044
+ elekcyjnych, 10,753 tokens): copy of sciaga.pl, Earwig 0.964, 43.9% of the words, the source
2045
+ captured since 2007-10-11, the wiki page created 2011-03-28. `wikibooks_27715` (Od lamera do
2046
+ hakera/Linux, 3,761 tokens): Polish translation (Paweł Niewiadomski, linuxpl.org) of chapter
2047
+ 6 of The Linux System Administrators' Guide (Lars Wirzenius, Joanna Oja); the page's own
2048
+ closing note gives CC BY-NC 3.0. `wikibooks_27602` (Od lamera do hakera/Procesor, 7,548
2049
+ tokens): text pasted on 2013-06-25, the source link lost, no licence given; Earwig suspects
2050
+ slideshare.net/slideshow/mikroprocesory/32678654 (0.896). `wikibooks_26962`
2051
+ (Mentalizm/Wprowadzenie, 1,313 tokens) and the 42 other pages of the Mentalizm book
2052
+ (234,691 tokens; hub `wikibooks_26961` included): the introduction states non-commercial
2053
+ share-alike terms (NC wording removed 2013-01-13, restored 2015-02-02); the other pages carry
2054
+ no notice of their own and are withheld with the book. Together 236,004 tokens.
2055
+
2056
+ **Mechanism** — the ids and reasons live in `DROPPED_PAGES["wikibooks"]` in `src/rights.py`;
2057
+ `fetch_wikimedia.py prepare` skips them and fails if one is not reached. Funnel: 34,967 pages
2058
+ → 12,838 in namespace 0 → 1,925 redirects, 1,247 short pages, 23 exact duplicates and the 46
2059
+ withheld pages skipped → 9,597 written → 531 non-Polish dropped → 9,066. Diff against the
2060
+ previous parquet: only the 46 ids removed, every other row identical. The 2 documents of the
2061
+ boundary day and the 435 GFDL-era documents are unchanged. None of the 46 is among the 45
2062
+ documents of `wikibooks.gfdl-review.json`; only its `source_tokens` (15,313,229) and the share
2063
+ in its summary (0.80%) were regenerated.
2064
+
2065
+ **Blockers** — none. Open: the copyright sample read 79 of the 9,112 pages and 90 more by one
2066
+ contributor; `wikibooks_27716` (145 tokens, lists CC-BY-NC and all-rights-reserved sources by
2067
+ name; kept) and `wikibooks_27071` (1,287 tokens, original licence not stated; kept);
2068
+ the 25 released pages that the "Od lamera do hakera" hub links in other books were not
2069
+ traced; E1 (v2#56); the 2 boundary documents; the 17 own-text and upstream GFDL documents;
2070
+ the markup residue.
data/wikibooks/wikibooks.attribution.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eaf71e246606e2b48cc00e928d03d8797052d710e4458ac346631fad1299d83a
3
+ size 2530004
data/wikibooks/wikibooks.build.json ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "attribution_rows": 9066,
3
+ "attribution_sha256": "eaf71e246606e2b48cc00e928d03d8797052d710e4458ac346631fad1299d83a",
4
+ "cutoff": "2023-06-07T00:00:00+00:00",
5
+ "discovered_at": "2026-10-06T00:00:19.659829+00:00",
6
+ "dump_base": "https://dumps.wikimedia.org/plwikibooks/20260601",
7
+ "dump_date": "20260601",
8
+ "file": {
9
+ "name": "plwikibooks-20260601-pages-articles.xml.bz2",
10
+ "sha1": "198ddcbe780725b2254a930bda4d498b94a59692",
11
+ "size": 20216648,
12
+ "url": "https://dumps.wikimedia.org/plwikibooks/20260601/plwikibooks-20260601-pages-articles.xml.bz2"
13
+ },
14
+ "labels": {
15
+ "after": "CC-BY-SA-4.0",
16
+ "before": "CC-BY-SA-3.0"
17
+ },
18
+ "prepare": {
19
+ "counts": {
20
+ "CC-BY-SA-3.0": 4588,
21
+ "CC-BY-SA-4.0": 5009,
22
+ "dropped_page": 46,
23
+ "exact_duplicate": 23,
24
+ "ns0": 12838,
25
+ "ns0_redirect": 1925,
26
+ "ns0_short": 1247,
27
+ "pages": 34967,
28
+ "written": 9597
29
+ },
30
+ "dropped_pages": [
31
+ {
32
+ "pageid": "23933",
33
+ "reason": "Historia powszechna/Rzeczpospolita pod panowaniem królów elekcyjnych: copy of sciaga.pl/tekst/40230-41-wojny_polsko_tureckie_w_xvii_w_i_i_ii_polowa_przyczyny_skutki (Earwig 0.964, 43.9% of words); the source was captured from 2007-10-11, the wiki page was created 2011-03-28",
34
+ "title": "Historia powszechna/Rzeczpospolita pod panowaniem królów elekcyjnych"
35
+ },
36
+ {
37
+ "pageid": "26961",
38
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
39
+ "title": "Mentalizm"
40
+ },
41
+ {
42
+ "pageid": "26962",
43
+ "reason": "Mentalizm/Wprowadzenie: states that the book may be used for non-commercial purposes under share-alike terms (NC wording removed 2013-01-13, restored 2015-02-02)",
44
+ "title": "Mentalizm/Wprowadzenie"
45
+ },
46
+ {
47
+ "pageid": "26963",
48
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
49
+ "title": "Mentalizm/Pozawerbalna komunikacja"
50
+ },
51
+ {
52
+ "pageid": "26964",
53
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
54
+ "title": "Mentalizm/Hipnoza i sugestia"
55
+ },
56
+ {
57
+ "pageid": "26968",
58
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
59
+ "title": "Mentalizm/NLP"
60
+ },
61
+ {
62
+ "pageid": "26969",
63
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
64
+ "title": "Mentalizm/Zakończenie"
65
+ },
66
+ {
67
+ "pageid": "27602",
68
+ "reason": "Od lamera do hakera/Procesor: text pasted from an outside site on 2013-06-25, the source link was lost, no licence is given; Earwig suspects slideshare.net/slideshow/mikroprocesory/32678654 (0.896); the original source and its licence are not identified",
69
+ "title": "Od lamera do hakera/Procesor"
70
+ },
71
+ {
72
+ "pageid": "27715",
73
+ "reason": "Od lamera do hakera/Linux: Polish translation (Paweł Niewiadomski, linuxpl.org) of chapter 6 of The Linux System Administrators' Guide (Lars Wirzenius, Joanna Oja); the page's own closing note gives the licence as CC BY-NC 3.0",
74
+ "title": "Od lamera do hakera/Linux"
75
+ },
76
+ {
77
+ "pageid": "28768",
78
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
79
+ "title": "Mentalizm/Nawyki: jak zmienić przyzwyczajenia"
80
+ },
81
+ {
82
+ "pageid": "28769",
83
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
84
+ "title": "Mentalizm/Szkoła w Summerhill: jak edukacja wpływa na osobowość"
85
+ },
86
+ {
87
+ "pageid": "28770",
88
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
89
+ "title": "Mentalizm/Stożek Zapamiętywania"
90
+ },
91
+ {
92
+ "pageid": "28771",
93
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
94
+ "title": "Mentalizm/Mapy myśli i inne graficzne formy notatek"
95
+ },
96
+ {
97
+ "pageid": "28772",
98
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
99
+ "title": "Mentalizm/Superlearning, czyli o wykorzystaniu relaksacji"
100
+ },
101
+ {
102
+ "pageid": "28776",
103
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
104
+ "title": "Mentalizm/Wpływ technologii na mózg i pamięć"
105
+ },
106
+ {
107
+ "pageid": "28777",
108
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
109
+ "title": "Mentalizm/Jak szybko można czytać?"
110
+ },
111
+ {
112
+ "pageid": "28778",
113
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
114
+ "title": "Mentalizm/Jak podwoić szybkość czytania"
115
+ },
116
+ {
117
+ "pageid": "28779",
118
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
119
+ "title": "Mentalizm/Aktywne czytanie: zwiększanie wydajności zapamiętywania"
120
+ },
121
+ {
122
+ "pageid": "28780",
123
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
124
+ "title": "Mentalizm/Możliwości ludzkiego mózgu i umysłu"
125
+ },
126
+ {
127
+ "pageid": "28781",
128
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
129
+ "title": "Mentalizm/Mnemoniczny System Podstawowy"
130
+ },
131
+ {
132
+ "pageid": "28782",
133
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
134
+ "title": "Mentalizm/Pałac pamięci"
135
+ },
136
+ {
137
+ "pageid": "28784",
138
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
139
+ "title": "Mentalizm/Mnemoniczny System Główny"
140
+ },
141
+ {
142
+ "pageid": "28785",
143
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
144
+ "title": "Mentalizm/Jak zapamiętać hasła"
145
+ },
146
+ {
147
+ "pageid": "28789",
148
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
149
+ "title": "Mentalizm/W jaki sposób mamią nas liczby i statystki"
150
+ },
151
+ {
152
+ "pageid": "28795",
153
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
154
+ "title": "Mentalizm/Zapamiętywanie nazw własnych i trudnych wyrażeń"
155
+ },
156
+ {
157
+ "pageid": "28796",
158
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
159
+ "title": "Mentalizm/Powtarzaj to, co już wiesz"
160
+ },
161
+ {
162
+ "pageid": "30772",
163
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
164
+ "title": "Mentalizm/Jak pisać dziennik i dlaczego"
165
+ },
166
+ {
167
+ "pageid": "31385",
168
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
169
+ "title": "Mentalizm/Ograniczenia ludzkiej percepcji i pamięci"
170
+ },
171
+ {
172
+ "pageid": "31393",
173
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
174
+ "title": "Mentalizm/O wywoływaniu duchów i zjaw"
175
+ },
176
+ {
177
+ "pageid": "31432",
178
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
179
+ "title": "Mentalizm/Psychologia wywierania wpływu"
180
+ },
181
+ {
182
+ "pageid": "31433",
183
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
184
+ "title": "Mentalizm/Mądrość tłumu - kiedy i dlaczego tłum jest mądrzejszy, niż jednostka"
185
+ },
186
+ {
187
+ "pageid": "31434",
188
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
189
+ "title": "Mentalizm/Medytacja i jej wpływ na mózg"
190
+ },
191
+ {
192
+ "pageid": "31634",
193
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
194
+ "title": "Mentalizm/Dlaczego wierzymy w pseudonaukę"
195
+ },
196
+ {
197
+ "pageid": "31635",
198
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
199
+ "title": "Mentalizm/Zimny odczyt"
200
+ },
201
+ {
202
+ "pageid": "31637",
203
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
204
+ "title": "Mentalizm/Przekaz podprogowy"
205
+ },
206
+ {
207
+ "pageid": "31649",
208
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
209
+ "title": "Mentalizm/Jak rozpoznać, czy ktoś mówi prawdę"
210
+ },
211
+ {
212
+ "pageid": "31652",
213
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
214
+ "title": "Mentalizm/Jak wywołać stan relaksu"
215
+ },
216
+ {
217
+ "pageid": "31653",
218
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
219
+ "title": "Mentalizm/Błyskawiczna indukcja hipnozy"
220
+ },
221
+ {
222
+ "pageid": "31654",
223
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
224
+ "title": "Mentalizm/Podłoże niektórych trików mentalistycznych"
225
+ },
226
+ {
227
+ "pageid": "31656",
228
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
229
+ "title": "Mentalizm/I Wykrywanie kłamstwa: wprowadzenie"
230
+ },
231
+ {
232
+ "pageid": "31658",
233
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
234
+ "title": "Mentalizm/II Wykrywanie kłamstwa"
235
+ },
236
+ {
237
+ "pageid": "31662",
238
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
239
+ "title": "Mentalizm/III Wykrywanie kłamstwa"
240
+ },
241
+ {
242
+ "pageid": "31664",
243
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
244
+ "title": "Mentalizm/IV Wykrywanie kłamstwa"
245
+ },
246
+ {
247
+ "pageid": "31667",
248
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
249
+ "title": "Mentalizm/V Wykrywanie kłamstwa"
250
+ },
251
+ {
252
+ "pageid": "31668",
253
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
254
+ "title": "Mentalizm/VI Wykrywanie kłamstwa"
255
+ },
256
+ {
257
+ "pageid": "31669",
258
+ "reason": "Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book",
259
+ "title": "Mentalizm/VII Wykrywanie kłamstwa"
260
+ }
261
+ ],
262
+ "exact_duplicate_pageids": [
263
+ "9415",
264
+ "11949",
265
+ "17793",
266
+ "17794",
267
+ "17795",
268
+ "17796",
269
+ "17797",
270
+ "17799",
271
+ "17801",
272
+ "17802",
273
+ "17803",
274
+ "22936",
275
+ "23461",
276
+ "32101",
277
+ "33984",
278
+ "36673",
279
+ "41196",
280
+ "41361",
281
+ "41368",
282
+ "41401",
283
+ "41424",
284
+ "59188",
285
+ "59948"
286
+ ]
287
+ },
288
+ "rightsinfo": {
289
+ "text": "Creative Commons Attribution-Share Alike 4.0",
290
+ "url": "https://creativecommons.org/licenses/by-sa/4.0/deed.pl",
291
+ "url_queried": "https://pl.wikibooks.org/w/api.php?action=query&meta=siteinfo&siprop=rightsinfo"
292
+ },
293
+ "sha1sums_url": "https://dumps.wikimedia.org/plwikibooks/20260601/plwikibooks-20260601-sha1sums.txt",
294
+ "switch": null,
295
+ "terms": [
296
+ {
297
+ "effective": "These Terms of Use went into effect on June 7, 2023",
298
+ "sha256": "c96ef93b439ff9b8242dc3233f41ede57c0984ef9153fafa51aa5f8cf0678832",
299
+ "statement": "Creative Commons Attribution-ShareAlike 4.0 International License",
300
+ "title": "Wikimedia Terms of Use in force since 7 June 2023 (CC BY-SA 4.0)",
301
+ "url": "https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=554823&action=raw"
302
+ },
303
+ {
304
+ "effective": "These Terms of Use went into effect on June 16, 2014",
305
+ "sha256": "46617e3576a507b8f83a0cf7b28b60e43817ad93cc5d747a558b503e7d1cc6de",
306
+ "statement": "Creative Commons Attribution-ShareAlike 3.0 Unported License",
307
+ "title": "Wikimedia Terms of Use of 2014-2023 (CC BY-SA 3.0)",
308
+ "url": "https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=98524&action=raw"
309
+ }
310
+ ]
311
+ }
data/wikibooks/wikibooks.gfdl-review.json ADDED
@@ -0,0 +1,543 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "wikibooks",
3
+ "reviewed_at": "2026-10-06",
4
+ "pattern": "gfdl|gnu\\s*fdl|\\bFDL\\b|gnu\\s+free\\s+doc|free\\s+documentation|wolnej\\s+dokumentacji",
5
+ "pattern_flags": "IGNORECASE",
6
+ "audit_pattern_closest": "\\bFDL\\b|Wolnej\\s+Dokumentacji",
7
+ "audit": {
8
+ "docs": 24,
9
+ "share_of_tokens": 0.004,
10
+ "named": [
11
+ "wikibooks_2419791",
12
+ "wikibooks_2419792"
13
+ ],
14
+ "named_now": [
15
+ "wikibooks_3153",
16
+ "wikibooks_3155"
17
+ ]
18
+ },
19
+ "matched": {
20
+ "docs": 45,
21
+ "tokens": 122192,
22
+ "source_tokens": 15313229
23
+ },
24
+ "closest_audit_pattern": {
25
+ "docs": 25,
26
+ "tokens": 69072,
27
+ "ids": [
28
+ "wikibooks_1710",
29
+ "wikibooks_1712",
30
+ "wikibooks_1946",
31
+ "wikibooks_2808",
32
+ "wikibooks_3083",
33
+ "wikibooks_3769",
34
+ "wikibooks_4219",
35
+ "wikibooks_5286",
36
+ "wikibooks_6097",
37
+ "wikibooks_6255",
38
+ "wikibooks_9553",
39
+ "wikibooks_10146",
40
+ "wikibooks_10244",
41
+ "wikibooks_10399",
42
+ "wikibooks_10433",
43
+ "wikibooks_10620",
44
+ "wikibooks_15078",
45
+ "wikibooks_15340",
46
+ "wikibooks_16148",
47
+ "wikibooks_24268",
48
+ "wikibooks_24460",
49
+ "wikibooks_24463",
50
+ "wikibooks_24489",
51
+ "wikibooks_27716",
52
+ "wikibooks_58197"
53
+ ]
54
+ },
55
+ "by_class": {
56
+ "own_text": {
57
+ "docs": 7,
58
+ "tokens": 42834
59
+ },
60
+ "licence_link": {
61
+ "docs": 13,
62
+ "tokens": 25387
63
+ },
64
+ "licence_discussion": {
65
+ "docs": 13,
66
+ "tokens": 44111
67
+ },
68
+ "upstream": {
69
+ "docs": 10,
70
+ "tokens": 6903
71
+ },
72
+ "incidental": {
73
+ "docs": 2,
74
+ "tokens": 2957
75
+ }
76
+ },
77
+ "classes": {
78
+ "own_text": "The page or book states that its own text is under the GNU FDL (alone or with CC BY-SA).",
79
+ "upstream": "The page names a GFDL-licensed work that the book translates, copies or builds on.",
80
+ "licence_link": "Table-of-contents or print-version link to the licence page; no statement of its own.",
81
+ "licence_discussion": "The page is about licences, or mentions the GNU FDL in passing.",
82
+ "incidental": "The match is not a licence statement."
83
+ },
84
+ "other_observations": [
85
+ {
86
+ "id": "wikibooks_27071",
87
+ "note": "Fizyka dla gimnazjum says the book was moved in 2013 from the 'Wolne podręczniki' portal 'with the consent of the portal's creators'; the original licence is not stated on the page and was not checked."
88
+ }
89
+ ],
90
+ "summary": "Review of GFDL mentions in the released text. The audit counted 24 documents (0.4% of tokens) and named wikibooks_2419791 and wikibooks_2419792 (now wikibooks_3153 and wikibooks_3155); its exact pattern is not recorded and could not be reproduced: the closest pattern here, `\\bFDL\\b|Wolnej\\s+Dokumentacji`, matches 25 documents (69,072 tokens) and neither named document. A wider case-insensitive pattern matches 45 documents (122,192 tokens, 0.80% of the source's tokens); all 45 were read and sorted: 7 state that the page or book is itself under the GNU FDL (42,834 tokens), 10 name a GFDL-licensed upstream work (6,903 tokens), 13 only link the licence page in a table of contents, 13 discuss licences, 2 match by accident. No GFDL label exists in this release and no row is dropped for a GFDL mention: every row keeps the CC BY-SA label its last-revision date gives. The 17 documents in the first two groups (49,737 tokens) are the ones where a GFDL-only grant by the page's author or upstream could matter; keeping or dropping them is left to the maintainers and the lawyer.",
91
+ "documents": [
92
+ {
93
+ "id": "wikibooks_1710",
94
+ "v025_id": "wikibooks_2419570",
95
+ "title": "Przewodnik po instalacji Debiana 3.0",
96
+ "tokens": 205,
97
+ "last_revision_at": "2021-07-05T13:00:37Z",
98
+ "license": "CC-BY-SA-3.0",
99
+ "class": "own_text",
100
+ "note": "Page says the Polish translation is under GNU FDL and CC BY-SA 3.0."
101
+ },
102
+ {
103
+ "id": "wikibooks_1712",
104
+ "v025_id": "wikibooks_2419571",
105
+ "title": "Debian - uniwersalna instalacja/Instalacja Debiana na nForce2 i dyskach SATA",
106
+ "tokens": 5314,
107
+ "last_revision_at": "2013-05-23T04:39:59Z",
108
+ "license": "CC-BY-SA-3.0",
109
+ "class": "own_text",
110
+ "note": "Page says the whole text is under CC BY-SA 3.0 and GNU FDL 1.2 at once (CC 'or any later version')."
111
+ },
112
+ {
113
+ "id": "wikibooks_1946",
114
+ "v025_id": "wikibooks_2419631",
115
+ "title": "Java - Myśleć jak programista",
116
+ "tokens": 19901,
117
+ "last_revision_at": "2021-07-04T18:50:07Z",
118
+ "license": "CC-BY-SA-3.0",
119
+ "class": "licence_link",
120
+ "note": "Table of contents ends with a 'GNU FDL' link (the licence page); no statement beyond that."
121
+ },
122
+ {
123
+ "id": "wikibooks_2725",
124
+ "v025_id": "wikibooks_2419693",
125
+ "title": "Inkscape w praktyce/Wstęp do programu",
126
+ "tokens": 3381,
127
+ "last_revision_at": "2013-07-07T11:21:58Z",
128
+ "license": "CC-BY-SA-3.0",
129
+ "class": "licence_discussion",
130
+ "note": "Remark that SVG pasted into a page used to count as GFDL."
131
+ },
132
+ {
133
+ "id": "wikibooks_2808",
134
+ "v025_id": "wikibooks_2419714",
135
+ "title": "OGRE/Wstęp",
136
+ "tokens": 280,
137
+ "last_revision_at": "2016-12-03T21:23:49Z",
138
+ "license": "CC-BY-SA-3.0",
139
+ "class": "upstream",
140
+ "note": "Notes on the OGRE wiki (said to be GNU FDL), mostly translated. Code samples are declared public domain."
141
+ },
142
+ {
143
+ "id": "wikibooks_2839",
144
+ "v025_id": "wikibooks_2419718",
145
+ "title": "C/O podręczniku",
146
+ "tokens": 919,
147
+ "last_revision_at": "2023-03-22T08:20:07Z",
148
+ "license": "CC-BY-SA-3.0",
149
+ "class": "upstream",
150
+ "note": "Sources list: the C Programming book on English Wikibooks, 'licencja GFDL'."
151
+ },
152
+ {
153
+ "id": "wikibooks_3083",
154
+ "v025_id": "wikibooks_2419770",
155
+ "title": "Aktualizacja i kompilacja jądra w Debianie",
156
+ "tokens": 264,
157
+ "last_revision_at": "2024-12-27T14:26:00Z",
158
+ "license": "CC-BY-SA-4.0",
159
+ "class": "own_text",
160
+ "note": "Page says the translation is under CC BY-SA 3.0 and GNU FDL. Last edit is after 2023-06-07, so the label is CC-BY-SA-4.0; the page's own statement names 3.0."
161
+ },
162
+ {
163
+ "id": "wikibooks_3153",
164
+ "v025_id": "wikibooks_2419791",
165
+ "title": "Zanurkuj w Pythonie/O podręczniku",
166
+ "tokens": 245,
167
+ "last_revision_at": "2016-06-09T19:03:50Z",
168
+ "license": "CC-BY-SA-3.0",
169
+ "class": "upstream",
170
+ "note": "Mostly a translation of Dive into Python by Mark Pilgrim, 'udostępnionej na licencji GNU Free Documentation License'. Audit-named example (v0.2.5 wikibooks_2419791)."
171
+ },
172
+ {
173
+ "id": "wikibooks_3155",
174
+ "v025_id": "wikibooks_2419792",
175
+ "title": "Zanurkuj w Pythonie/Zalecenia dla autorów",
176
+ "tokens": 2409,
177
+ "last_revision_at": "2012-09-01T12:37:31Z",
178
+ "license": "CC-BY-SA-3.0",
179
+ "class": "upstream",
180
+ "note": "Translation of Dive into Python, under 'a licence compatible with the Wikibooks licence (GNU Free Documentation License)'. Audit-named example (v0.2.5 wikibooks_2419792)."
181
+ },
182
+ {
183
+ "id": "wikibooks_3202",
184
+ "v025_id": "wikibooks_2419805",
185
+ "title": "Wprowadzenie do elektroniki/Wersja do druku",
186
+ "tokens": 394,
187
+ "last_revision_at": "2025-02-13T13:10:30Z",
188
+ "license": "CC-BY-SA-4.0",
189
+ "class": "licence_link",
190
+ "note": "Print version; ends with a 'GNU Free Documentation License' link."
191
+ },
192
+ {
193
+ "id": "wikibooks_3499",
194
+ "v025_id": "wikibooks_2419853",
195
+ "title": "OGRE/Wersja do druku",
196
+ "tokens": 160,
197
+ "last_revision_at": "2021-12-13T07:57:35Z",
198
+ "license": "CC-BY-SA-3.0",
199
+ "class": "licence_link",
200
+ "note": "Print version; table of contents lists 'GNU Free Documentation License'."
201
+ },
202
+ {
203
+ "id": "wikibooks_3515",
204
+ "v025_id": "wikibooks_2419855",
205
+ "title": "OpenGL Shading Language/Wersja do druku",
206
+ "tokens": 213,
207
+ "last_revision_at": "2021-12-13T07:58:56Z",
208
+ "license": "CC-BY-SA-3.0",
209
+ "class": "licence_link",
210
+ "note": "Print version; table of contents lists 'GNU Free Documentation License'."
211
+ },
212
+ {
213
+ "id": "wikibooks_3769",
214
+ "v025_id": "wikibooks_2419899",
215
+ "title": "PHP/O podręczniku",
216
+ "tokens": 757,
217
+ "last_revision_at": "2011-04-20T05:32:53Z",
218
+ "license": "CC-BY-SA-3.0",
219
+ "class": "own_text",
220
+ "note": "Invites edits 'if you see no obstacle in the liberal GNU FDL licence', i.e. describes the book as GNU FDL."
221
+ },
222
+ {
223
+ "id": "wikibooks_3860",
224
+ "v025_id": "wikibooks_2419929",
225
+ "title": "C++/Spis treści",
226
+ "tokens": 1220,
227
+ "last_revision_at": "2023-07-25T00:47:50Z",
228
+ "license": "CC-BY-SA-4.0",
229
+ "class": "licence_link",
230
+ "note": "Table of contents row 'Licencja: Pełny tekst GNU Free Documentation license'."
231
+ },
232
+ {
233
+ "id": "wikibooks_4208",
234
+ "v025_id": "wikibooks_2420028",
235
+ "title": "Akwarium/O podręczniku",
236
+ "tokens": 234,
237
+ "last_revision_at": "2026-01-25T14:00:37Z",
238
+ "license": "CC-BY-SA-4.0",
239
+ "class": "own_text",
240
+ "note": "Author's licence template, GFDL 1.2 or later, worded for 'this graphic'; the same page says the user is the author of the book."
241
+ },
242
+ {
243
+ "id": "wikibooks_4219",
244
+ "v025_id": "wikibooks_2420035",
245
+ "title": "Fortran",
246
+ "tokens": 589,
247
+ "last_revision_at": "2022-09-25T05:37:43Z",
248
+ "license": "CC-BY-SA-3.0",
249
+ "class": "licence_link",
250
+ "note": "Table of contents row 'Licencja GNU FDL: Licencja, na której udostępniony jest ten podręcznik'."
251
+ },
252
+ {
253
+ "id": "wikibooks_4858",
254
+ "v025_id": "wikibooks_2420187",
255
+ "title": "C++/Dla autorów",
256
+ "tokens": 1195,
257
+ "last_revision_at": "2026-04-15T08:25:20Z",
258
+ "license": "CC-BY-SA-4.0",
259
+ "class": "licence_discussion",
260
+ "note": "Author guidance: text from GFDL or CC BY-SA sources may be copied with attribution; GPL code may not."
261
+ },
262
+ {
263
+ "id": "wikibooks_5236",
264
+ "v025_id": "wikibooks_2420266",
265
+ "title": "Borland C++ Compiler/O podręczniku",
266
+ "tokens": 1169,
267
+ "last_revision_at": "2023-07-05T14:28:02Z",
268
+ "license": "CC-BY-SA-4.0",
269
+ "class": "upstream",
270
+ "note": "History: the manual was first an e-zine article, then 'released' by its author under GFDL, then came here."
271
+ },
272
+ {
273
+ "id": "wikibooks_5286",
274
+ "v025_id": "wikibooks_2420279",
275
+ "title": "Organiczna technika studiowania/Wersja do druku",
276
+ "tokens": 603,
277
+ "last_revision_at": "2021-12-13T08:00:36Z",
278
+ "license": "CC-BY-SA-3.0",
279
+ "class": "licence_link",
280
+ "note": "Print version; table of contents lists 'Licencja GNU FDL'."
281
+ },
282
+ {
283
+ "id": "wikibooks_6097",
284
+ "v025_id": "wikibooks_2420473",
285
+ "title": "Informatyka dla klas 7-8 szkoły podstawowej/Prawo autorskie, patenty, znaki handlowe i ochrona danych",
286
+ "tokens": 631,
287
+ "last_revision_at": "2025-10-31T21:09:28Z",
288
+ "license": "CC-BY-SA-4.0",
289
+ "class": "licence_discussion",
290
+ "note": "Schoolbook chapter listing common licences, GNU FDL among them."
291
+ },
292
+ {
293
+ "id": "wikibooks_6255",
294
+ "v025_id": "wikibooks_2420518",
295
+ "title": "Hiszpański/Planowanie",
296
+ "tokens": 894,
297
+ "last_revision_at": "2025-03-04T11:50:33Z",
298
+ "license": "CC-BY-SA-4.0",
299
+ "class": "licence_discussion",
300
+ "note": "Links to outside texts under GFDL, CC-BY and others, with a reminder to check each."
301
+ },
302
+ {
303
+ "id": "wikibooks_6582",
304
+ "v025_id": "wikibooks_2420580",
305
+ "title": "PHP/Wersja do druku",
306
+ "tokens": 79,
307
+ "last_revision_at": "2021-12-13T08:04:24Z",
308
+ "license": "CC-BY-SA-3.0",
309
+ "class": "licence_link",
310
+ "note": "Print version; ends with a 'GNU Free Documentation License' link."
311
+ },
312
+ {
313
+ "id": "wikibooks_6936",
314
+ "v025_id": "wikibooks_2420638",
315
+ "title": "Icon/O podręczniku",
316
+ "tokens": 189,
317
+ "last_revision_at": "2016-12-03T21:23:08Z",
318
+ "license": "CC-BY-SA-3.0",
319
+ "class": "upstream",
320
+ "note": "Sources list: the Programming:Icon book on English Wikibooks, 'licencja GFDL'."
321
+ },
322
+ {
323
+ "id": "wikibooks_9553",
324
+ "v025_id": "wikibooks_2420865",
325
+ "title": "Struktury danych/Konwencje",
326
+ "tokens": 441,
327
+ "last_revision_at": "2014-07-10T13:18:40Z",
328
+ "license": "CC-BY-SA-3.0",
329
+ "class": "own_text",
330
+ "note": "Invites edits from people who 'see no obstacle in the GNU FDL licence', i.e. describes the book as GNU FDL."
331
+ },
332
+ {
333
+ "id": "wikibooks_10127",
334
+ "v025_id": "wikibooks_2420966",
335
+ "title": "Ruby",
336
+ "tokens": 678,
337
+ "last_revision_at": "2024-11-21T15:02:22Z",
338
+ "license": "CC-BY-SA-4.0",
339
+ "class": "upstream",
340
+ "note": "Starting point is Mark Slagell's 'Ruby's User Guide', GNU Free Documentation License."
341
+ },
342
+ {
343
+ "id": "wikibooks_10146",
344
+ "v025_id": "wikibooks_2420972",
345
+ "title": "MediaWiki w obrazkach/Wstawianie obrazków",
346
+ "tokens": 5161,
347
+ "last_revision_at": "2019-07-25T03:01:59Z",
348
+ "license": "CC-BY-SA-3.0",
349
+ "class": "licence_discussion",
350
+ "note": "MediaWiki tutorial: names the upload-form option 'multilicensed GNU FDL and CC-BY 2.5'."
351
+ },
352
+ {
353
+ "id": "wikibooks_10174",
354
+ "v025_id": "wikibooks_2420978",
355
+ "title": "Jak zrobić dobry zielnik/Wersja do druku",
356
+ "tokens": 155,
357
+ "last_revision_at": "2022-06-29T11:04:48Z",
358
+ "license": "CC-BY-SA-3.0",
359
+ "class": "licence_link",
360
+ "note": "Print version; ends with a 'GNU Free Documentation License' link."
361
+ },
362
+ {
363
+ "id": "wikibooks_10197",
364
+ "v025_id": "wikibooks_2420980",
365
+ "title": "ModPlug Tracker/Wersja do druku",
366
+ "tokens": 128,
367
+ "last_revision_at": "2021-12-13T08:09:56Z",
368
+ "license": "CC-BY-SA-3.0",
369
+ "class": "licence_link",
370
+ "note": "Print version; ends with a 'GNU Free Documentation License' link."
371
+ },
372
+ {
373
+ "id": "wikibooks_10244",
374
+ "v025_id": "wikibooks_2420993",
375
+ "title": "MediaWiki w obrazkach/Terminologia",
376
+ "tokens": 3884,
377
+ "last_revision_at": "2015-08-22T20:09:16Z",
378
+ "license": "CC-BY-SA-3.0",
379
+ "class": "licence_discussion",
380
+ "note": "Glossary entry for 'free licence' naming GNU FDL."
381
+ },
382
+ {
383
+ "id": "wikibooks_10397",
384
+ "v025_id": "wikibooks_2421024",
385
+ "title": "W świetle GNU/Wikimedia",
386
+ "tokens": 2295,
387
+ "last_revision_at": "2025-12-09T18:38:15Z",
388
+ "license": "CC-BY-SA-4.0",
389
+ "class": "licence_discussion",
390
+ "note": "Essay on Wikimedia and copyleft; quotes the Wikimedia Polska statutes naming the GNU FDL."
391
+ },
392
+ {
393
+ "id": "wikibooks_10399",
394
+ "v025_id": "wikibooks_2421026",
395
+ "title": "W świetle GNU/W świetle GNU",
396
+ "tokens": 4341,
397
+ "last_revision_at": "2010-11-20T17:10:01Z",
398
+ "license": "CC-BY-SA-3.0",
399
+ "class": "licence_discussion",
400
+ "note": "Essay on copyleft; says Wikimedia text was GNU FDL until May 2009, then GNU FDL and CC BY-SA."
401
+ },
402
+ {
403
+ "id": "wikibooks_10433",
404
+ "v025_id": "wikibooks_2421029",
405
+ "title": "W świetle GNU/Licencje",
406
+ "tokens": 2291,
407
+ "last_revision_at": "2025-10-16T19:55:13Z",
408
+ "license": "CC-BY-SA-4.0",
409
+ "class": "licence_discussion",
410
+ "note": "Essay describing the GNU FDL."
411
+ },
412
+ {
413
+ "id": "wikibooks_10620",
414
+ "v025_id": "wikibooks_2421073",
415
+ "title": "Linux - wprowadzenie",
416
+ "tokens": 850,
417
+ "last_revision_at": "2023-03-10T00:21:43Z",
418
+ "license": "CC-BY-SA-3.0",
419
+ "class": "licence_link",
420
+ "note": "Table of contents row 'Licencja Wolnej Dokumentacji GNU'."
421
+ },
422
+ {
423
+ "id": "wikibooks_15078",
424
+ "v025_id": "wikibooks_2418334",
425
+ "title": "LaTeX/Pisanie listów",
426
+ "tokens": 785,
427
+ "last_revision_at": "2024-07-14T16:01:22Z",
428
+ "license": "CC-BY-SA-4.0",
429
+ "class": "incidental",
430
+ "note": "LaTeX example letter that mentions an enclosed GFDL text."
431
+ },
432
+ {
433
+ "id": "wikibooks_15340",
434
+ "v025_id": "wikibooks_2418412",
435
+ "title": "Poradnik harcerski",
436
+ "tokens": 829,
437
+ "last_revision_at": "2026-03-17T10:18:30Z",
438
+ "license": "CC-BY-SA-4.0",
439
+ "class": "licence_link",
440
+ "note": "Table of contents row 'Treści licencji GNU FDL'."
441
+ },
442
+ {
443
+ "id": "wikibooks_16148",
444
+ "v025_id": "wikibooks_2418678",
445
+ "title": "Axiom/Wstęp",
446
+ "tokens": 407,
447
+ "last_revision_at": "2016-12-18T15:13:35Z",
448
+ "license": "CC-BY-SA-3.0",
449
+ "class": "upstream",
450
+ "note": "Notes on the Axiom engine documentation (said to be GNU FDL), mostly translated."
451
+ },
452
+ {
453
+ "id": "wikibooks_24268",
454
+ "v025_id": "wikibooks_2422519",
455
+ "title": "Informatyka dla klas 7-8 szkoły podstawowej/Wstęp",
456
+ "tokens": 462,
457
+ "last_revision_at": "2025-10-31T20:58:48Z",
458
+ "license": "CC-BY-SA-4.0",
459
+ "class": "upstream",
460
+ "note": "Original content copied from the 'Magiczny Flet' textbook (version of 2003-09-16), 'na licencji GNU FDL'."
461
+ },
462
+ {
463
+ "id": "wikibooks_24460",
464
+ "v025_id": "wikibooks_2422555",
465
+ "title": "Przewodnik po OZE/Licencje",
466
+ "tokens": 4469,
467
+ "last_revision_at": "2023-02-25T15:35:17Z",
468
+ "license": "CC-BY-SA-3.0",
469
+ "class": "licence_discussion",
470
+ "note": "Open-educational-resources guide; describes licences, GNU FDL among them."
471
+ },
472
+ {
473
+ "id": "wikibooks_24463",
474
+ "v025_id": "wikibooks_2422557",
475
+ "title": "Przewodnik po OZE/Katalog Otwartych Zasobów Edukacyjnych",
476
+ "tokens": 8148,
477
+ "last_revision_at": "2023-02-25T22:17:57Z",
478
+ "license": "CC-BY-SA-3.0",
479
+ "class": "licence_discussion",
480
+ "note": "Open-educational-resources guide; catalogue of sources and their licences."
481
+ },
482
+ {
483
+ "id": "wikibooks_24489",
484
+ "v025_id": "wikibooks_2422565",
485
+ "title": "Przewodnik po OZE/Publikowanie i oznaczanie treści licencjami",
486
+ "tokens": 5868,
487
+ "last_revision_at": "2011-06-19T11:10:51Z",
488
+ "license": "CC-BY-SA-3.0",
489
+ "class": "licence_discussion",
490
+ "note": "Open-educational-resources guide; says CC BY / CC BY-SA can be combined with GNU FDL material."
491
+ },
492
+ {
493
+ "id": "wikibooks_27442",
494
+ "v025_id": "wikibooks_2423173",
495
+ "title": "Zanurkuj w Pythonie/Wersja ePUB",
496
+ "tokens": 266,
497
+ "last_revision_at": "2021-12-13T08:21:28Z",
498
+ "license": "CC-BY-SA-3.0",
499
+ "class": "licence_link",
500
+ "note": "ePUB version; table of contents lists 'GNU Free Documentation License'."
501
+ },
502
+ {
503
+ "id": "wikibooks_27716",
504
+ "v025_id": "wikibooks_2423192",
505
+ "title": "Od lamera do hakera/Bibliografia",
506
+ "tokens": 145,
507
+ "last_revision_at": "2016-11-12T10:05:11Z",
508
+ "license": "CC-BY-SA-3.0",
509
+ "class": "upstream",
510
+ "note": "Bibliography lists sources with their licences: BrowseHappy course GNU FDL. It also lists a source as CC-BY-NC 3.0 and two as all rights reserved; whether any of that text was copied was not checked."
511
+ },
512
+ {
513
+ "id": "wikibooks_30538",
514
+ "v025_id": "wikibooks_2423377",
515
+ "title": "Linux i Systemy Wbudowane",
516
+ "tokens": 35619,
517
+ "last_revision_at": "2022-02-02T08:56:48Z",
518
+ "license": "CC-BY-SA-3.0",
519
+ "class": "own_text",
520
+ "note": "First line: 'Udostępnione na licencji GNU Free Documentation License'. Whole book; no mention of CC BY-SA in the text. Largest doc in the set."
521
+ },
522
+ {
523
+ "id": "wikibooks_58197",
524
+ "v025_id": "wikibooks_2424744",
525
+ "title": "Koncepcje programowania/Licencjonowanie",
526
+ "tokens": 1553,
527
+ "last_revision_at": "2021-12-25T10:32:51Z",
528
+ "license": "CC-BY-SA-3.0",
529
+ "class": "licence_discussion",
530
+ "note": "Chapter on licensing; CC BY-SA 'closest to GNU FDL'; code samples under MIT."
531
+ },
532
+ {
533
+ "id": "wikibooks_59080",
534
+ "v025_id": "wikibooks_2415779",
535
+ "title": "Programowanie w systemie UNIX/man",
536
+ "tokens": 2172,
537
+ "last_revision_at": "2022-11-29T11:45:53Z",
538
+ "license": "CC-BY-SA-3.0",
539
+ "class": "incidental",
540
+ "note": "File listing of a man-page directory; matches 'gfdl.7gcc.gz'."
541
+ }
542
+ ]
543
+ }
data/wikibooks/wikibooks.license-evidence.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "checked_at": "2026-10-06",
3
+ "cutoff": {
4
+ "after": "CC-BY-SA-4.0",
5
+ "at": "2023-06-07T00:00:00+00:00",
6
+ "before": "CC-BY-SA-3.0",
7
+ "boundary_day": {
8
+ "day": "2023-06-07",
9
+ "docs_last_edited_that_day": 2
10
+ }
11
+ },
12
+ "legal": [
13
+ {
14
+ "section": "4(b)(ii)",
15
+ "sha256": "c33d7ebdbcc5c8db073e69a794b2ac44805f5d7d9edcfb8b5181a71869a9b7d5",
16
+ "statement": "a later version of this License with the same License Elements as this License",
17
+ "url": "https://creativecommons.org/licenses/by-sa/3.0/legalcode"
18
+ },
19
+ {
20
+ "section": "3(b)(1)",
21
+ "sha256": "47c0a954c88d793bdefe92fb007ae3c038fb3807f1a27083433d01aa7542c0d8",
22
+ "statement": "this version or later, or a BY-SA Compatible License",
23
+ "url": "https://creativecommons.org/licenses/by-sa/4.0/legalcode"
24
+ }
25
+ ],
26
+ "license": "CC-BY-SA-3.0 or CC-BY-SA-4.0 per record, by the page's last revision",
27
+ "release_scope": {
28
+ "created_range": [
29
+ "2006-03-05",
30
+ "2026-05-31"
31
+ ],
32
+ "labels": {
33
+ "CC-BY-SA-3.0": 4425,
34
+ "CC-BY-SA-4.0": 4641
35
+ },
36
+ "last_edited_before_era_end": {
37
+ "date": "2009-06-15",
38
+ "docs": 435,
39
+ "tokens": 259065
40
+ },
41
+ "tokens": {
42
+ "CC-BY-SA-3.0": 5916490,
43
+ "CC-BY-SA-4.0": 9396739
44
+ }
45
+ },
46
+ "review_scope": "licence of contributors' text on pl.wikibooks.org and its version per page; not independent legal advice",
47
+ "site_licence": {
48
+ "observed_at": "2026-10-06T00:00:19.659829+00:00",
49
+ "rightsinfo": {
50
+ "text": "Creative Commons Attribution-Share Alike 4.0",
51
+ "url": "https://creativecommons.org/licenses/by-sa/4.0/deed.pl",
52
+ "url_queried": "https://pl.wikibooks.org/w/api.php?action=query&meta=siteinfo&siprop=rightsinfo"
53
+ }
54
+ },
55
+ "spdx": [
56
+ "https://spdx.org/licenses/CC-BY-SA-3.0.html",
57
+ "https://spdx.org/licenses/CC-BY-SA-4.0.html"
58
+ ],
59
+ "status": "documented-open-cc-by-sa",
60
+ "switch": null,
61
+ "terms": [
62
+ {
63
+ "effective": "These Terms of Use went into effect on June 7, 2023",
64
+ "sha256": "c96ef93b439ff9b8242dc3233f41ede57c0984ef9153fafa51aa5f8cf0678832",
65
+ "statement": "Creative Commons Attribution-ShareAlike 4.0 International License",
66
+ "title": "Wikimedia Terms of Use in force since 7 June 2023 (CC BY-SA 4.0)",
67
+ "url": "https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=554823&action=raw"
68
+ },
69
+ {
70
+ "effective": "These Terms of Use went into effect on June 16, 2014",
71
+ "sha256": "46617e3576a507b8f83a0cf7b28b60e43817ad93cc5d747a558b503e7d1cc6de",
72
+ "statement": "Creative Commons Attribution-ShareAlike 3.0 Unported License",
73
+ "title": "Wikimedia Terms of Use of 2014-2023 (CC BY-SA 3.0)",
74
+ "url": "https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=98524&action=raw"
75
+ }
76
+ ]
77
+ }
data/wikibooks/wikibooks.md CHANGED
@@ -1,43 +1,99 @@
1
  # wikibooks
2
 
3
- Polish Wikibooks (open textbooks)
4
 
5
  ## Dataset description
6
- - **Source (upstream):** https://pl.wikibooks.org/
7
  - **Domain:** instructional
8
  - **Language:** Polish (pl)
9
- - **License:** `CC-BY-SA-3.0`
10
- - **Created (range):** 2004-01-01, 2025-12-31
11
- - **Added:** 2026-07-02
12
 
13
  ## Licensing — traceable basis
14
- Wikibooks content is released under CC-BY-SA 3.0; attribution + share-alike preserved.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  ## Provenance
17
- Fetched directly from the official Wikimedia dump (plwikibooks-latest-pages-articles) by src/fetch_wikimedia.py; mainspace only, wikitext stripped via mwparserfromhell.
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  ## Statistics
20
  | documents | characters | tokens (tiktoken proxy) |
21
  |---:|---:|---:|
22
- | 9,112 | 38,892,589 | 15,571,295 |
23
 
 
24
 
25
  ## Per-document license metadata
26
  | license | documents |
27
  |---|---:|
28
- | `CC-BY-SA-3.0` | 9,112 |
 
29
 
30
- Author metadata present for **0** documents. Empty values mean the upstream record did not expose a machine-readable author field.
31
-
32
- Statistics were recomputed directly from the released parquet file.
33
 
34
  ## Filters applied (build_dynaword.py)
35
- Minimal, per Dynaword guidelines (heavy filtering left to downstream use):
36
- - drop documents < 200 chars: **0**
37
- - drop non-Polish (diacritic ratio): **0**
38
  - exact cross-source dedup (sha1): **0**
39
  - OCR alpha-ratio < 0.70 (OCR sources only): **0**
40
- - read 9,112 → kept 9,112
41
 
42
  Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
43
  Llama-3 count is computed at release.
 
 
 
 
 
 
 
 
 
 
 
1
  # wikibooks
2
 
3
+ Polish Wikibooks
4
 
5
  ## Dataset description
6
+ - **Source (upstream):** https://dumps.wikimedia.org/plwikibooks/20260601/
7
  - **Domain:** instructional
8
  - **Language:** Polish (pl)
9
+ - **License:** `CC-BY-SA-3.0` or `CC-BY-SA-4.0` per record (by last-revision date)
10
+ - **Created (range):** 2006-03-05, 2026-05-31 (date of the page's last revision in the dump)
11
+ - **Added:** 2026-07-02; rebuilt 2026-10-06 (UTC) from the official Wikimedia dump
12
 
13
  ## Licensing — traceable basis
14
+ Contributors' text on pl.wikibooks.org is licensed CC BY-SA: [Wikimedia Terms of Use in force since 7 June 2023 (CC BY-SA 4.0)](https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=554823&action=raw); [Wikimedia Terms of Use of 2014-2023 (CC BY-SA 3.0)](https://foundation.wikimedia.org/w/index.php?title=Policy:Terms_of_Use&oldid=98524&action=raw) (read 2026-10-06 UTC). The site licence
15
+ (`rightsinfo`) reads "Creative Commons Attribution-Share Alike 4.0". Each row is labelled by its page's last revision in the dump:
16
+
17
+ | last revision (UTC) | `license` | documents | tokens | share of tokens |
18
+ |---|---|---:|---:|---:|
19
+ | before 2023-06-07 | `CC-BY-SA-3.0` | 4,425 | 5,916,490 | 38.6% |
20
+ | 2023-06-07 or later | `CC-BY-SA-4.0` | 4,641 | 9,396,739 | 61.4% |
21
+
22
+ A page last edited on or after the cutoff can still hold 3.0 text from earlier edits;
23
+ [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/legalcode) §4(b)(ii) lets such an adaptation be licensed under "a later
24
+ version of this License with the same License Elements", so it is labelled 4.0. The Terms
25
+ of Use give the day of the switch, not the time. The cutoff is midnight UTC, so the
26
+ 2 pages last edited on 2023-06-07 itself are labelled 4.0. If the switch came later
27
+ that day, those last edited before it are 3.0 text under a 4.0 label; a 2023-06-08 cutoff
28
+ (the citation pass's fallback) would instead put that day's 4.0 edits under a 3.0 label,
29
+ which [4.0](https://creativecommons.org/licenses/by-sa/4.0/legalcode) §3(b)(1) ("this version or later") does not allow. Neither choice is
30
+ exact without the time of the switch. The rule is `license_for_revision` in `src/rights.py`,
31
+ tested at the cutoff second, across time zones, and on a missing timestamp, which stops the
32
+ build. v0.2.0-v0.2.5 labelled every row `CC-BY-SA-3.0`.
33
+
34
+ 435 documents (259,065 tokens, 1.7%) were last edited before 2009-06-15, when the Wikimedia sites
35
+ began dual licensing under CC BY-SA 3.0 and the GFDL. Text first contributed before the 2009 move was
36
+ under the GFDL only. They are labelled `CC-BY-SA-3.0`, so only the CC BY-SA grant is relied on; the count is recorded, not acted on.
37
+
38
+ Review of GFDL mentions in the released text. The audit counted 24 documents (0.4% of tokens) and named wikibooks_2419791 and wikibooks_2419792 (now wikibooks_3153 and wikibooks_3155); its exact pattern is not recorded and could not be reproduced: the closest pattern here, `\bFDL\b|Wolnej\s+Dokumentacji`, matches 25 documents (69,072 tokens) and neither named document. A wider case-insensitive pattern matches 45 documents (122,192 tokens, 0.80% of the source's tokens); all 45 were read and sorted: 7 state that the page or book is itself under the GNU FDL (42,834 tokens), 10 name a GFDL-licensed upstream work (6,903 tokens), 13 only link the licence page in a table of contents, 13 discuss licences, 2 match by accident. No GFDL label exists in this release and no row is dropped for a GFDL mention: every row keeps the CC BY-SA label its last-revision date gives. The 17 documents in the first two groups (49,737 tokens) are the ones where a GFDL-only grant by the page's author or upstream could matter; keeping or dropping them is left to the maintainers and the lawyer. Per-document notes: `wikibooks.gfdl-review.json`.
39
+
40
+ Evidence: `wikibooks.license-evidence.json`.
41
+
42
+ ## Attribution
43
+ Each row's `author` is `Wikibooks contributors, <page URL>`, e.g.
44
+ `Wikibooks contributors, https://pl.wikibooks.org/wiki/C`. The page history names the contributors; the Terms of Use (section 7b) accept a hyperlink or URL to the page as attribution.
45
+ `wikibooks.attribution.jsonl` has one line per row: `id`, `pageid`, `revid` (the revision
46
+ in the dump), `title`, `url`, `last_revision_at`, `license`. The row `id` is
47
+ `wikibooks_<page id>` and `created` is the date of `last_revision_at`.
48
+
49
+ The text is modified: wiki markup is converted to plain text (see Provenance).
50
 
51
  ## Provenance
52
+ Parsed from the official Wikimedia dump `plwikibooks-20260601-pages-articles` by
53
+ `src/fetch_wikimedia.py`; the file (20,216,648 bytes, sha1 `198ddcbe780725b2254a930bda4d498b94a59692`) was matched against the
54
+ dump's `dumpstatus.json` and `sha1sums.txt` (`wikibooks.build.json`). v0.2.0-v0.2.5 used the same dump
55
+ date; the text set is the same except for the withheld pages (the rebuild adds the last-revision time).
56
+
57
+ Articles (namespace 0) only. Redirects, empty pages and pages shorter than 200 characters are skipped.
58
+ Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5.
59
+ Templates and comments are dropped. `<ref>` bodies, category links (`Kategoria:...`) and file-link
60
+ options (`thumb|...`) are not removed and stay in the text; the wikipedia fetcher's `strip_article`
61
+ removes them, this one does not, because that would change the text set. Of two pages with the same
62
+ text (sha1 of the stripped text), the lower page id is kept.
63
+
64
+ 34,967 pages scanned → 12,838 in namespace 0 → 1,925 redirects, 0 empty pages, 0 parser failures, 1,247 shorter than 200 characters skipped, 23 exact duplicates dropped, 46 pages withheld by the rights review (`DROPPED_PAGES` in `src/rights.py`; ids, titles and reasons in `wikibooks.build.json`) → 9,597 read by the build → 9,066 released.
65
 
66
  ## Statistics
67
  | documents | characters | tokens (tiktoken proxy) |
68
  |---:|---:|---:|
69
+ | 9,066 | 38,195,523 | 15,313,229 |
70
 
71
+ v0.2.5 had 9,112 documents, 38,892,589 characters and 15,571,295 tokens; the difference is the 46 pages withheld by the rights review.
72
 
73
  ## Per-document license metadata
74
  | license | documents |
75
  |---|---:|
76
+ | `CC-BY-SA-3.0` | 4,425 |
77
+ | `CC-BY-SA-4.0` | 4,641 |
78
 
79
+ Author metadata present for **9,066** documents.
 
 
80
 
81
  ## Filters applied (build_dynaword.py)
82
+ - drop documents < 200 chars: **0** (the fetcher already dropped 1,247)
83
+ - drop non-Polish (diacritic ratio): **531**
 
84
  - exact cross-source dedup (sha1): **0**
85
  - OCR alpha-ratio < 0.70 (OCR sources only): **0**
86
+ - read 9,597 → kept 9,066
87
 
88
  Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
89
  Llama-3 count is computed at release.
90
+
91
+ ## Not checked
92
+ - pastes from copyrighted sources (no sample was run)
93
+ - the 3.0 → 4.0 label of pages edited after the cutoff (a reading of 3.0 §4(b)(ii), not a lawyer's opinion;
94
+ the lawyer's answer to E1, the wiki 3.0/4.0 labelling, is still pending), and the time of day of the switch
95
+ - text imported from elsewhere under another licence or with extra attribution requirements
96
+ - text first contributed under GFDL before the 2009 move to CC BY-SA, and GFDL dual
97
+ licensing; only the CC BY-SA grant is relied on
98
+ - quotations inside articles (Art. 29 of the Polish copyright act)
99
+ - personal data (the NERGAL scrub runs before release)
data/wikibooks/wikibooks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b081c981c033478044ed162d30c00897c4dd8e244b09d7807e5dc3d16bd91a3a
3
- size 14319121
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bfe6d5fa93bda9b6a833aff11a8fbff379594310fa9d8c18a469cf8ffd1ebb1
3
+ size 14204247
data/wikibooks/wikibooks.stats.json CHANGED
@@ -1,16 +1,17 @@
1
  {
2
- "read": 9112,
3
- "kept": 9112,
4
  "drop_short": 0,
5
- "drop_lang": 0,
6
  "drop_dup": 0,
7
  "drop_ocr": 0,
8
- "chars": 38892589,
9
- "tokens": 15571295,
10
  "licenses": {
11
- "CC-BY-SA-3.0": 9112
 
12
  },
13
- "authors_with_value": 0,
14
- "license": "CC-BY-SA-3.0",
15
- "stats_recomputed_from_parquet": true
16
- }
 
1
  {
2
+ "read": 9597,
3
+ "kept": 9066,
4
  "drop_short": 0,
5
+ "drop_lang": 531,
6
  "drop_dup": 0,
7
  "drop_ocr": 0,
8
+ "chars": 38195523,
9
+ "tokens": 15313229,
10
  "licenses": {
11
+ "CC-BY-SA-4.0": 4641,
12
+ "CC-BY-SA-3.0": 4425
13
  },
14
+ "authors_with_value": 9066,
15
+ "secs": 2.0,
16
+ "license": "CC BY-SA (3.0 or 4.0 per record, by last-revision date)"
17
+ }
src/fetch_wikimedia.py CHANGED
@@ -36,7 +36,9 @@ from build_plwiki_talk_pl import ( # noqa: E402 shared dump helpers
36
  UA, digest, load, now, request, request_json, save, sha1_file,
37
  )
38
  from fetch_wikipedia import pages, text_key # noqa: E402
39
- from rights import BY_SA_4_CUTOFF, WIKINEWS_BY_4_CUTOFF, license_for_revision # noqa: E402
 
 
40
 
41
  DUMP_DATE = "20260601" # the dump the v0.2.5 text was cut from (checked: same text set)
42
  MIN_CHARS = 200 # same gate as build_dynaword.py
@@ -183,10 +185,12 @@ def acquire(out: Path, key: str) -> None:
183
 
184
 
185
  def prepare(out: Path, key: str) -> None:
186
- """Label each page, drop exact duplicates keeping the lowest page id, write the build input."""
187
- site = SITES[key]
 
 
188
  src = out / "raw_dump" / load(out / f"{key}.selection.json")["file"]["name"]
189
- seen, counts, duplicates, last_id = set(), Counter(), [], 0
190
  zst = subprocess.Popen(["zstd", "-q", "-f", "-3", "-o", str(out / f"{site['wiki']}.jsonl.zst")], stdin=subprocess.PIPE)
191
  try:
192
  with bz2.open(src, "rb") as fh, gzip.open(out / f"{key}.manifest.jsonl.gz", "wt", encoding="utf-8") as manifest:
@@ -211,6 +215,9 @@ def prepare(out: Path, key: str) -> None:
211
  duplicates.append(pageid)
212
  else:
213
  seen.add(text_key(text))
 
 
 
214
  lic = label(key, timestamp)
215
  counts["written"] += 1
216
  counts[lic] += 1
@@ -228,7 +235,10 @@ def prepare(out: Path, key: str) -> None:
228
  status = zst.wait()
229
  if status:
230
  raise RuntimeError("zstd failed")
231
- save(out / f"{key}.prepare.json", {"counts": dict(counts), "exact_duplicate_pageids": duplicates})
 
 
 
232
  print(key, dict(counts))
233
 
234
 
@@ -335,8 +345,11 @@ def datasheet(out: Path, data_dir: Path, key: str) -> None:
335
  labels = "\n".join(f"| `{lab}` | {scope['labels'].get(lab, 0):,} |" for lab in (before, after))
336
  v_docs, v_chars, v_tokens = site["v025"]
337
  same = (kept, st["chars"], tok) == (v_docs, v_chars, v_tokens)
 
338
  v025 = ("The same text set as v0.2.5: documents, characters and tokens are unchanged; only labels, ids, authors and dates differ."
339
- if same else f"v0.2.5 had {v_docs:,} documents, {v_chars:,} characters and {v_tokens:,} tokens.")
 
 
340
  old = scope["last_edited_before_era_end"]
341
  if "SA" in after:
342
  era = (f"{old['docs']:,} documents ({old['tokens']:,} tokens, {share(old['tokens'], tok)}) were last edited before {old['date']}, when the Wikimedia sites\n"
@@ -354,6 +367,8 @@ def datasheet(out: Path, data_dir: Path, key: str) -> None:
354
  f"{prep.get('ns0_strip_error', 0):,} parser failures", f"{prep.get('ns0_short', 0):,} shorter than {MIN_CHARS} characters"]
355
  chain = (f"{prep['pages']:,} pages scanned → {prep['ns0']:,} in namespace 0 → " + ", ".join(skipped) + " skipped"
356
  + (f", {prep['exact_duplicate']:,} exact duplicates dropped" if prep.get("exact_duplicate") else ", no exact duplicates")
 
 
357
  + f" → {prep['written']:,} read by the build → {kept:,} released.")
358
  terms = "; ".join(f"[{t['title']}]({t['url']})" for t in ev["terms"])
359
  with (data_dir / f"{key}.attribution.jsonl").open(encoding="utf-8") as fh:
@@ -399,7 +414,7 @@ The text is modified: wiki markup is converted to plain text (see Provenance).
399
  Parsed from the official Wikimedia dump `{file['name'][:-8]}` by
400
  `src/fetch_wikimedia.py`; the file ({file['size']:,} bytes, sha1 `{file['sha1']}`) was matched against the
401
  dump's `dumpstatus.json` and `sha1sums.txt` (`{key}.build.json`). v0.2.0-v0.2.5 used the same dump
402
- date; the text set is the same (the rebuild adds the last-revision time).
403
 
404
  Articles (namespace 0) only. Redirects, empty pages and pages shorter than {MIN_CHARS} characters are skipped.
405
  Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5.
 
36
  UA, digest, load, now, request, request_json, save, sha1_file,
37
  )
38
  from fetch_wikipedia import pages, text_key # noqa: E402
39
+ from rights import ( # noqa: E402
40
+ BY_SA_4_CUTOFF, DROPPED_PAGES, WIKINEWS_BY_4_CUTOFF, check_dropped_reached, license_for_revision,
41
+ )
42
 
43
  DUMP_DATE = "20260601" # the dump the v0.2.5 text was cut from (checked: same text set)
44
  MIN_CHARS = 200 # same gate as build_dynaword.py
 
185
 
186
 
187
  def prepare(out: Path, key: str) -> None:
188
+ """Label each page, drop exact duplicates keeping the lowest page id and the pages in
189
+ DROPPED_PAGES[key], write the build input. A dropped page's text stays in `seen`, so a later
190
+ page with the same text is dropped as its duplicate."""
191
+ site, dropped_ids = SITES[key], DROPPED_PAGES[key]
192
  src = out / "raw_dump" / load(out / f"{key}.selection.json")["file"]["name"]
193
+ seen, counts, duplicates, dropped, last_id = set(), Counter(), [], [], 0
194
  zst = subprocess.Popen(["zstd", "-q", "-f", "-3", "-o", str(out / f"{site['wiki']}.jsonl.zst")], stdin=subprocess.PIPE)
195
  try:
196
  with bz2.open(src, "rb") as fh, gzip.open(out / f"{key}.manifest.jsonl.gz", "wt", encoding="utf-8") as manifest:
 
215
  duplicates.append(pageid)
216
  else:
217
  seen.add(text_key(text))
218
+ if int(pageid) in dropped_ids:
219
+ dropped.append({"pageid": pageid, "title": title, "reason": dropped_ids[int(pageid)]})
220
+ continue
221
  lic = label(key, timestamp)
222
  counts["written"] += 1
223
  counts[lic] += 1
 
235
  status = zst.wait()
236
  if status:
237
  raise RuntimeError("zstd failed")
238
+ check_dropped_reached(key, [p["pageid"] for p in dropped])
239
+ counts["dropped_page"] = len(dropped)
240
+ save(out / f"{key}.prepare.json", {"counts": dict(counts), "exact_duplicate_pageids": duplicates,
241
+ "dropped_pages": dropped})
242
  print(key, dict(counts))
243
 
244
 
 
345
  labels = "\n".join(f"| `{lab}` | {scope['labels'].get(lab, 0):,} |" for lab in (before, after))
346
  v_docs, v_chars, v_tokens = site["v025"]
347
  same = (kept, st["chars"], tok) == (v_docs, v_chars, v_tokens)
348
+ n_dropped = prep.get("dropped_page", 0)
349
  v025 = ("The same text set as v0.2.5: documents, characters and tokens are unchanged; only labels, ids, authors and dates differ."
350
+ if same else f"v0.2.5 had {v_docs:,} documents, {v_chars:,} characters and {v_tokens:,} tokens"
351
+ + (f"; the difference is the {n_dropped:,} pages withheld by the rights review." if n_dropped else "."))
352
+ same_set = "the text set is the same" + (" except for the withheld pages" if n_dropped else "")
353
  old = scope["last_edited_before_era_end"]
354
  if "SA" in after:
355
  era = (f"{old['docs']:,} documents ({old['tokens']:,} tokens, {share(old['tokens'], tok)}) were last edited before {old['date']}, when the Wikimedia sites\n"
 
367
  f"{prep.get('ns0_strip_error', 0):,} parser failures", f"{prep.get('ns0_short', 0):,} shorter than {MIN_CHARS} characters"]
368
  chain = (f"{prep['pages']:,} pages scanned → {prep['ns0']:,} in namespace 0 → " + ", ".join(skipped) + " skipped"
369
  + (f", {prep['exact_duplicate']:,} exact duplicates dropped" if prep.get("exact_duplicate") else ", no exact duplicates")
370
+ + (f", {n_dropped:,} pages withheld by the rights review (`DROPPED_PAGES` in `src/rights.py`; ids, titles and reasons in `{key}.build.json`)"
371
+ if n_dropped else "")
372
  + f" → {prep['written']:,} read by the build → {kept:,} released.")
373
  terms = "; ".join(f"[{t['title']}]({t['url']})" for t in ev["terms"])
374
  with (data_dir / f"{key}.attribution.jsonl").open(encoding="utf-8") as fh:
 
414
  Parsed from the official Wikimedia dump `{file['name'][:-8]}` by
415
  `src/fetch_wikimedia.py`; the file ({file['size']:,} bytes, sha1 `{file['sha1']}`) was matched against the
416
  dump's `dumpstatus.json` and `sha1sums.txt` (`{key}.build.json`). v0.2.0-v0.2.5 used the same dump
417
+ date; {same_set} (the rebuild adds the last-revision time).
418
 
419
  Articles (namespace 0) only. Redirects, empty pages and pages shorter than {MIN_CHARS} characters are skipped.
420
  Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5.
src/rights.py CHANGED
@@ -6,7 +6,8 @@ Wire into build_dynaword.py only for europeana (per-record); other sources keep
6
  their single per-source license.
7
 
8
  Also holds license_for_revision(): the per-page label of the Wikimedia sources
9
- (wikipedia, wikinews, wikivoyage, wikibooks), chosen by the page's last revision.
 
10
  """
11
  from __future__ import annotations
12
 
@@ -62,6 +63,50 @@ def license_for_revision(timestamp: str | None, cutoff: datetime = BY_SA_4_CUTOF
62
  return after if ts >= cutoff else before
63
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  if __name__ == "__main__": # self-check
66
  assert rights_ok("http://creativecommons.org/licenses/by-sa/4.0/")
67
  assert rights_ok("https://creativecommons.org/publicdomain/mark/1.0/")
@@ -76,4 +121,5 @@ if __name__ == "__main__": # self-check
76
  assert spdx("http://creativecommons.org/publicdomain/mark/1.0/") == "public-domain (PDM-1.0)"
77
  assert license_for_revision("2023-06-06T23:59:59Z") == "CC-BY-SA-3.0"
78
  assert license_for_revision("2023-06-07T00:00:00Z") == "CC-BY-SA-4.0"
 
79
  print("ok")
 
6
  their single per-source license.
7
 
8
  Also holds license_for_revision(): the per-page label of the Wikimedia sources
9
+ (wikipedia, wikinews, wikivoyage, wikibooks), chosen by the page's last revision, and
10
+ DROPPED_PAGES: the pages the rights review withheld from wikinews, wikivoyage and wikibooks.
11
  """
12
  from __future__ import annotations
13
 
 
63
  return after if ts >= cutoff else before
64
 
65
 
66
+ # The pages of the wikibooks book "Mentalizm" other than its introduction (26962), which carries the notice.
67
+ _MENTALIZM_REST = (
68
+ 26961, 26963, 26964, 26968, 26969, 28768, 28769, 28770, 28771, 28772, 28776, 28777, 28778, 28779,
69
+ 28780, 28781, 28782, 28784, 28785, 28789, 28795, 28796, 30772, 31385, 31393, 31432, 31433, 31434,
70
+ 31634, 31635, 31637, 31649, 31652, 31653, 31654, 31656, 31658, 31662, 31664, 31667, 31668, 31669,
71
+ )
72
+ _MENTALIZM_REASON = ("Mentalizm book (one author, Pedros.lol): Mentalizm/Wprowadzenie (26962) states "
73
+ "non-commercial share-alike terms; this page has no notice of its own, so it is withheld with the book")
74
+
75
+ # Pages withheld from a Wikimedia source after a rights review: {source: {wiki page id: reason}},
76
+ # one reason per page. The page id is stable across dumps (the dataset id is derived from it).
77
+ # fetch_wikimedia.prepare skips these pages and fails if one is not reached (see
78
+ # check_dropped_reached); a skipped page's text stays in the duplicate set, so a page that
79
+ # repeats it is dropped as its duplicate. Each source's block is edited by its own PR.
80
+ DROPPED_PAGES: dict[str, dict[int, str]] = {
81
+ "wikinews": {
82
+ },
83
+ "wikivoyage": {
84
+ },
85
+ "wikibooks": {
86
+ 23933: "Historia powszechna/Rzeczpospolita pod panowaniem królów elekcyjnych: copy of sciaga.pl/tekst/"
87
+ "40230-41-wojny_polsko_tureckie_w_xvii_w_i_i_ii_polowa_przyczyny_skutki (Earwig 0.964, 43.9% of "
88
+ "words); the source was captured from 2007-10-11, the wiki page was created 2011-03-28",
89
+ 27715: "Od lamera do hakera/Linux: Polish translation (Paweł Niewiadomski, linuxpl.org) of chapter 6 of "
90
+ "The Linux System Administrators' Guide (Lars Wirzenius, Joanna Oja); the page's own closing note "
91
+ "gives the licence as CC BY-NC 3.0",
92
+ 27602: "Od lamera do hakera/Procesor: text pasted from an outside site on 2013-06-25, the source link was "
93
+ "lost, no licence is given; Earwig suspects slideshare.net/slideshow/mikroprocesory/32678654 (0.896); "
94
+ "the original source and its licence are not identified",
95
+ 26962: "Mentalizm/Wprowadzenie: states that the book may be used for non-commercial purposes under "
96
+ "share-alike terms (NC wording removed 2013-01-13, restored 2015-02-02)",
97
+ **{page: _MENTALIZM_REASON for page in _MENTALIZM_REST},
98
+ },
99
+ }
100
+
101
+
102
+ def check_dropped_reached(source: str, reached) -> None:
103
+ """Fail unless every DROPPED_PAGES[source] id is in `reached` (the ids prepare dropped for that reason)."""
104
+ missing = set(DROPPED_PAGES[source]) - {int(p) for p in reached}
105
+ if missing:
106
+ raise ValueError(f"DROPPED_PAGES[{source!r}] not reached (gone from the dump, a redirect, "
107
+ f"too short or a duplicate): {sorted(missing)}")
108
+
109
+
110
  if __name__ == "__main__": # self-check
111
  assert rights_ok("http://creativecommons.org/licenses/by-sa/4.0/")
112
  assert rights_ok("https://creativecommons.org/publicdomain/mark/1.0/")
 
121
  assert spdx("http://creativecommons.org/publicdomain/mark/1.0/") == "public-domain (PDM-1.0)"
122
  assert license_for_revision("2023-06-06T23:59:59Z") == "CC-BY-SA-3.0"
123
  assert license_for_revision("2023-06-07T00:00:00Z") == "CC-BY-SA-4.0"
124
+ check_dropped_reached("wikibooks", []) # an empty list is always reached
125
  print("ok")
src/sources.py CHANGED
@@ -437,18 +437,34 @@ SOURCES = {
437
  "added": "2026-07-02",
438
  "release": "0.2.0",
439
  "file_key": "plwikibooks",
 
 
440
  "pretty": "Polish Wikibooks (open textbooks)",
441
- "license": "CC-BY-SA-3.0",
442
- "license_spdx": "CC-BY-SA-3.0",
443
- "traceable": "Wikibooks content is released under CC-BY-SA 3.0; "
444
- "attribution + share-alike preserved.",
445
- "upstream": "https://pl.wikibooks.org/",
446
- "provenance": "Fetched directly from the official Wikimedia dump "
447
- "(plwikibooks-latest-pages-articles) by src/fetch_wikimedia.py; "
448
- "mainspace only, wikitext stripped via mwparserfromhell.",
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  "domain": "instructional",
450
- "created": "2004-01-01, 2025-12-31",
451
  "is_ocr": False,
 
452
  },
453
  "wikiquote": {
454
  "added": "2026-07-02",
 
437
  "added": "2026-07-02",
438
  "release": "0.2.0",
439
  "file_key": "plwikibooks",
440
+ "preserve_id": True,
441
+ "preserve_created": True,
442
  "pretty": "Polish Wikibooks (open textbooks)",
443
+ "provenance": "Parsed directly from the official Wikimedia dump "
444
+ "plwikibooks-20260601-pages-articles (sha1 checked against the "
445
+ "dump's dumpstatus.json and sha1sums.txt) by "
446
+ "src/fetch_wikimedia.py. Articles (namespace 0) only, no "
447
+ "redirects; one document per page, id from the page id. The text "
448
+ "set is the one released in v0.2.0-v0.2.5 without the 46 pages "
449
+ "the rights review withheld (DROPPED_PAGES in src/rights.py); the "
450
+ "rebuild adds the page's last-revision time, which sets the "
451
+ "licence label.",
452
+ "license": "CC BY-SA (3.0 or 4.0 per record, by last-revision date)",
453
+ "license_spdx": "MIXED",
454
+ "traceable": "Contributors license their text under CC BY-SA 4.0 since the "
455
+ "Wikimedia Terms of Use of 2023-06-07, under CC BY-SA 3.0 before. "
456
+ "A page whose last revision predates 2023-06-07 is labelled "
457
+ "CC-BY-SA-3.0; a page revised on or after that day is an "
458
+ "adaptation of the 3.0 text, which 3.0 §4(b)(ii) allows under 4.0, "
459
+ "and is labelled CC-BY-SA-4.0. Each row's author field links its "
460
+ "page, whose history names the contributors; "
461
+ "wikibooks.attribution.jsonl gives page id, revision id, title and "
462
+ "last-revision time per row.",
463
+ "upstream": "https://dumps.wikimedia.org/plwikibooks/20260601/",
464
  "domain": "instructional",
465
+ "created": "2006-03-05, 2026-05-31",
466
  "is_ocr": False,
467
+ "custom_datasheet": True,
468
  },
469
  "wikiquote": {
470
  "added": "2026-07-02",
src/test_wikibooks_contract.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Contract checks for the released wikibooks source (Polish Wikibooks, CC BY-SA 3.0 until 2023-06-07 and CC BY-SA 4.0 after); the shared checks live in test_wikimedia_contract.py."""
2
+
3
+ from collections import Counter
4
+ import json
5
+
6
+ import pyarrow.parquet as pq
7
+
8
+ import rights
9
+ from test_wikimedia_contract import ROOT, check_released
10
+
11
+ # the v0.2.5 rows (documents, characters, tokens) that the rights review withholds: 3 copied pages and the 43-page Mentalizm book
12
+ WITHHELD = (46, 697066, 258066)
13
+
14
+
15
+ def test_wikibooks_contract(tmp_path):
16
+ stats, ev = check_released("wikibooks", tmp_path, dropped=WITHHELD)
17
+ assert (stats["kept"], stats["tokens"]) == (9066, 15313229)
18
+ assert stats["licenses"] == {"CC-BY-SA-3.0": 4425, "CC-BY-SA-4.0": 4641}
19
+ assert ev["release_scope"]["tokens"] == {"CC-BY-SA-3.0": 5916490, "CC-BY-SA-4.0": 9396739}
20
+ assert ev["cutoff"]["boundary_day"] == {"day": "2023-06-07", "docs_last_edited_that_day": 2}
21
+ assert ev["release_scope"]["last_edited_before_era_end"] == {"date": "2009-06-15", "docs": 435, "tokens": 259065}
22
+
23
+
24
+ def test_wikibooks_gfdl_review_matches_the_release():
25
+ """The 45 documents that mention the GNU FDL were read by hand; the file records them, the release does not label or drop them."""
26
+ review = json.loads((ROOT / "data" / "wikibooks" / "wikibooks.gfdl-review.json").read_text(encoding="utf-8"))
27
+ cols = pq.read_table(ROOT / "data" / "wikibooks" / "wikibooks.parquet", columns=["id", "token_count", "license"]).to_pydict()
28
+ by_id = {i: (t, lic) for i, t, lic in zip(cols["id"], cols["token_count"], cols["license"])}
29
+ docs = review["documents"]
30
+ assert len(docs) == len({d["id"] for d in docs}) == review["matched"]["docs"] == 45
31
+ assert sum(d["tokens"] for d in docs) == review["matched"]["tokens"] == 122192
32
+ assert review["matched"]["source_tokens"] == sum(by_id_t for by_id_t, _ in by_id.values())
33
+ for d in docs:
34
+ assert by_id[d["id"]] == (d["tokens"], d["license"]) # still in the release, label unchanged by the review
35
+ assert d["class"] in review["classes"] and d["note"] and d["v025_id"].startswith("wikibooks_")
36
+ by_class = Counter(d["class"] for d in docs)
37
+ assert {c: v["docs"] for c, v in review["by_class"].items()} == dict(by_class)
38
+ assert {c: v["tokens"] for c, v in review["by_class"].items()} == {c: sum(d["tokens"] for d in docs if d["class"] == c) for c in by_class}
39
+ assert review["closest_audit_pattern"]["docs"] == len(review["closest_audit_pattern"]["ids"]) == 25
40
+ assert set(review["closest_audit_pattern"]["ids"]) <= set(by_id)
41
+ assert not set(review["audit"]["named_now"]) & set(review["closest_audit_pattern"]["ids"]) # the audit's two named docs are not in the 25
42
+
43
+
44
+ def test_wikibooks_withholds_three_copied_pages_and_the_mentalizm_book():
45
+ withheld = rights.DROPPED_PAGES["wikibooks"]
46
+ book = {i for i, reason in withheld.items() if reason.startswith("Mentalizm")}
47
+ assert len(withheld) == 46 and all(withheld.values())
48
+ assert set(withheld) - book == {23933, 27715, 27602}
49
+ assert len(book) == 43 and {26961, 26962} <= book # the introduction that carries the notice, the hub page and 41 chapters
50
+ data = ROOT / "data" / "wikibooks"
51
+ ids = set(pq.read_table(data / "wikibooks.parquet", columns=["id"]).column("id").to_pylist())
52
+ assert not {f"wikibooks_{i}" for i in withheld} & ids
53
+ build = json.loads((data / "wikibooks.build.json").read_text(encoding="utf-8"))
54
+ listed = {int(p["pageid"]): p["reason"] for p in build["prepare"]["dropped_pages"]}
55
+ assert listed == withheld and all(p["title"] for p in build["prepare"]["dropped_pages"])
56
+ assert build["prepare"]["counts"]["dropped_page"] == 46
src/test_wikimedia_contract.py CHANGED
@@ -13,6 +13,7 @@ from pathlib import Path
13
  import re
14
  import shutil
15
  import subprocess
 
16
 
17
  import pyarrow as pa
18
  import pyarrow.parquet as pq
@@ -196,10 +197,12 @@ def _selection(tmp_path, key):
196
  })
197
 
198
 
199
- def _prepare(tmp_path, key, xml):
 
200
  _selection(tmp_path, key)
201
  (tmp_path / "raw_dump" / NAME).write_bytes(bz2.compress(xml.encode()))
202
- fm.prepare(tmp_path, key)
 
203
  out = subprocess.run(["zstd", "-dc", str(tmp_path / f"pl{key}.jsonl.zst")], capture_output=True, check=True)
204
  return [json.loads(line) for line in out.stdout.decode().splitlines()]
205
 
@@ -224,8 +227,8 @@ def test_prepare_labels_filters_and_dedups(tmp_path, key):
224
  assert set(rows[0]) == {"id", "text", "created", "license", "author"}
225
  prep = _read(tmp_path / f"{key}.prepare.json")
226
  assert prep == {"counts": {"pages": 9, "ns0": 8, "ns0_redirect": 1, "ns0_empty": 1, "ns0_short": 1,
227
- "exact_duplicate": 1, "written": 4, before: 2, after: 2},
228
- "exact_duplicate_pageids": ["15"]}
229
  with gzip.open(tmp_path / f"{key}.manifest.jsonl.gz", "rt", encoding="utf-8") as fh:
230
  manifest = [json.loads(line) for line in fh]
231
  assert [(m["id"], m["pageid"], m["revid"], m["license"]) for m in manifest] == [
@@ -233,6 +236,48 @@ def test_prepare_labels_filters_and_dedups(tmp_path, key):
233
  assert manifest[1]["last_revision_at"] == _stamp(cut) and manifest[1]["title"] == "Ala"
234
 
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  @needs_zstd
237
  def test_prepare_fails_on_a_dump_out_of_page_id_order(tmp_path):
238
  xml = _wrap(_page(20, "A", 0, "2020-01-01T00:00:00Z", BODY), _page(10, "B", 0, "2020-01-01T00:00:00Z", DOG))
@@ -312,8 +357,9 @@ def test_attribution_fails_when_the_parquet_has_a_row_the_dump_does_not(tmp_path
312
 
313
  # --- the contract on a released source -----------------------------------------------------
314
 
315
- def check_released(key, tmp_path):
316
- """Checks that hold for any source built by fetch_wikimedia.py; counts specific to a source live in its own test file."""
 
317
  site, data, entry = fm.SITES[key], ROOT / "data" / key, SOURCES[key]
318
  stats, build, ev = (_read(data / f"{key}.{n}.json") for n in ("stats", "build", "license-evidence"))
319
  assert pq.read_schema(data / f"{key}.parquet").names == ["id", "text", "source", "added", "created", "token_count", "license", "author"]
@@ -329,11 +375,16 @@ def check_released(key, tmp_path):
329
  # rows, counts, the unchanged text set
330
  assert n == stats["kept"] == build["attribution_rows"] == len(meta) == len(set(cols["id"]))
331
  assert set(cols["source"]) == {key} and len(set(cols["added"])) == 1
332
- assert (stats["kept"], stats["chars"], stats["tokens"]) == site["v025"] # the rebuild changes labels, not the text set
 
 
 
333
  assert sum(len(t) for t in cols["text"]) == stats["chars"] and sum(cols["token_count"]) == stats["tokens"]
334
  assert min(len(t) for t in cols["text"]) >= fm.MIN_CHARS and stats["drop_short"] == stats["drop_dup"] == 0
335
  counts = build["prepare"]["counts"]
336
- skipped = sum(counts.get(k, 0) for k in ("ns0_redirect", "ns0_empty", "ns0_strip_error", "ns0_short", "exact_duplicate"))
 
 
337
  assert counts["ns0"] == skipped + counts["written"] and counts["written"] == stats["read"] == n + stats["drop_lang"]
338
  assert counts[site["before"]] + counts[site["after"]] == counts["written"]
339
  assert build["attribution_sha256"] == fm.digest(sidecar)
 
13
  import re
14
  import shutil
15
  import subprocess
16
+ from unittest import mock
17
 
18
  import pyarrow as pa
19
  import pyarrow.parquet as pq
 
197
  })
198
 
199
 
200
+ def _prepare(tmp_path, key, xml, dropped=None):
201
+ """Runs prepare on a fixture dump; its pages are not the real withheld ones, so the list is `dropped` (none by default)."""
202
  _selection(tmp_path, key)
203
  (tmp_path / "raw_dump" / NAME).write_bytes(bz2.compress(xml.encode()))
204
+ with mock.patch.dict(rights.DROPPED_PAGES, {key: dropped or {}}):
205
+ fm.prepare(tmp_path, key)
206
  out = subprocess.run(["zstd", "-dc", str(tmp_path / f"pl{key}.jsonl.zst")], capture_output=True, check=True)
207
  return [json.loads(line) for line in out.stdout.decode().splitlines()]
208
 
 
227
  assert set(rows[0]) == {"id", "text", "created", "license", "author"}
228
  prep = _read(tmp_path / f"{key}.prepare.json")
229
  assert prep == {"counts": {"pages": 9, "ns0": 8, "ns0_redirect": 1, "ns0_empty": 1, "ns0_short": 1,
230
+ "exact_duplicate": 1, "dropped_page": 0, "written": 4, before: 2, after: 2},
231
+ "exact_duplicate_pageids": ["15"], "dropped_pages": []}
232
  with gzip.open(tmp_path / f"{key}.manifest.jsonl.gz", "rt", encoding="utf-8") as fh:
233
  manifest = [json.loads(line) for line in fh]
234
  assert [(m["id"], m["pageid"], m["revid"], m["license"]) for m in manifest] == [
 
236
  assert manifest[1]["last_revision_at"] == _stamp(cut) and manifest[1]["title"] == "Ala"
237
 
238
 
239
+ @needs_zstd
240
+ @pytest.mark.parametrize("key", KEYS)
241
+ def test_prepare_drops_listed_pages_and_their_copies(tmp_path, key):
242
+ site = fm.SITES[key]
243
+ rows = _prepare(tmp_path, key, _fixture(key), dropped={10: "Ala: withheld by the rights review"})
244
+ # 10 is withheld; its text stays in the duplicate set, so 15 (a copy of it) is still dropped
245
+ assert [r["id"] for r in rows] == [f"{key}_{i}" for i in (5, 16, 17)]
246
+ prep = _read(tmp_path / f"{key}.prepare.json")
247
+ assert prep["dropped_pages"] == [{"pageid": "10", "title": "Ala", "reason": "Ala: withheld by the rights review"}]
248
+ assert prep["exact_duplicate_pageids"] == ["15"]
249
+ assert (prep["counts"]["dropped_page"], prep["counts"]["exact_duplicate"], prep["counts"]["written"]) == (1, 1, 3)
250
+ assert prep["counts"][site["before"]] + prep["counts"][site["after"]] == 3
251
+ with gzip.open(tmp_path / f"{key}.manifest.jsonl.gz", "rt", encoding="utf-8") as fh:
252
+ assert [json.loads(line)["pageid"] for line in fh] == [5, 16, 17]
253
+
254
+
255
+ @needs_zstd
256
+ @pytest.mark.parametrize("pageid, why", [
257
+ (99, "not in the dump"), (11, "a redirect"), (12, "not in namespace 0"), (13, "empty"), (14, "short"),
258
+ (15, "a duplicate of 10"),
259
+ ])
260
+ def test_prepare_fails_when_a_listed_page_is_not_reached(tmp_path, pageid, why):
261
+ with pytest.raises(ValueError, match=rf"DROPPED_PAGES\['wikibooks'\] not reached.*\[{pageid}\]"):
262
+ _prepare(tmp_path, "wikibooks", _fixture("wikibooks"), dropped={pageid: why})
263
+
264
+
265
+ def test_check_dropped_reached(monkeypatch):
266
+ monkeypatch.setitem(rights.DROPPED_PAGES, "wikinews", {3: "a", 7: "b"})
267
+ rights.check_dropped_reached("wikinews", ["7", 3, 9]) # ids arrive as dump strings or ints; extras are fine
268
+ with pytest.raises(ValueError, match=r"DROPPED_PAGES\['wikinews'\] not reached.*\[7\]"):
269
+ rights.check_dropped_reached("wikinews", ["3"])
270
+ with pytest.raises(KeyError):
271
+ rights.check_dropped_reached("wikipedia", []) # wikipedia keeps its own COPIED_PAGES
272
+
273
+
274
+ def test_dropped_pages_cover_the_three_sources_with_one_reason_per_page():
275
+ assert set(rights.DROPPED_PAGES) == set(KEYS)
276
+ for key, pages in rights.DROPPED_PAGES.items():
277
+ assert all(type(i) is int and i > 0 for i in pages), key
278
+ assert all(isinstance(r, str) and len(r) > 10 for r in pages.values()), key
279
+
280
+
281
  @needs_zstd
282
  def test_prepare_fails_on_a_dump_out_of_page_id_order(tmp_path):
283
  xml = _wrap(_page(20, "A", 0, "2020-01-01T00:00:00Z", BODY), _page(10, "B", 0, "2020-01-01T00:00:00Z", DOG))
 
357
 
358
  # --- the contract on a released source -----------------------------------------------------
359
 
360
+ def check_released(key, tmp_path, dropped=(0, 0, 0)):
361
+ """Checks that hold for any source built by fetch_wikimedia.py; counts specific to a source live in its own test file.
362
+ `dropped` is (documents, characters, tokens) of the v0.2.5 rows that DROPPED_PAGES[key] withholds."""
363
  site, data, entry = fm.SITES[key], ROOT / "data" / key, SOURCES[key]
364
  stats, build, ev = (_read(data / f"{key}.{n}.json") for n in ("stats", "build", "license-evidence"))
365
  assert pq.read_schema(data / f"{key}.parquet").names == ["id", "text", "source", "added", "created", "token_count", "license", "author"]
 
375
  # rows, counts, the unchanged text set
376
  assert n == stats["kept"] == build["attribution_rows"] == len(meta) == len(set(cols["id"]))
377
  assert set(cols["source"]) == {key} and len(set(cols["added"])) == 1
378
+ # the rebuild changes labels, not the text set, apart from the pages the rights review withheld
379
+ assert (stats["kept"], stats["chars"], stats["tokens"]) == tuple(v - d for v, d in zip(site["v025"], dropped))
380
+ withheld = rights.DROPPED_PAGES[key]
381
+ assert dropped[0] == len(withheld) and not {f"{key}_{i}" for i in withheld} & set(cols["id"])
382
  assert sum(len(t) for t in cols["text"]) == stats["chars"] and sum(cols["token_count"]) == stats["tokens"]
383
  assert min(len(t) for t in cols["text"]) >= fm.MIN_CHARS and stats["drop_short"] == stats["drop_dup"] == 0
384
  counts = build["prepare"]["counts"]
385
+ skipped = sum(counts.get(k, 0) for k in ("ns0_redirect", "ns0_empty", "ns0_strip_error", "ns0_short", "exact_duplicate", "dropped_page"))
386
+ assert {int(p["pageid"]): p["reason"] for p in build["prepare"].get("dropped_pages", [])} == withheld
387
+ assert counts.get("dropped_page", 0) == len(withheld)
388
  assert counts["ns0"] == skipped + counts["written"] and counts["written"] == stats["read"] == n + stats["drop_lang"]
389
  assert counts[site["before"]] + counts[site["after"]] == counts["written"]
390
  assert build["attribution_sha256"] == fm.digest(sidecar)