Contributor guidance: source findings log + PR/normalization requirements

#17
by ppuzio - opened
Files changed (2) hide show
  1. AGENTS.md +83 -0
  2. artifacts/source_findings.md +543 -0
AGENTS.md CHANGED
@@ -22,6 +22,13 @@ So datasheets and the README narrative are **hand/contributor-maintained**.
22
  Never run `make_docs.py` and commit the result blind — `git diff` first and
23
  restore anything it dropped or restamped.
24
 
 
 
 
 
 
 
 
25
  ## Add a source
26
 
27
  1. Produce the artifact under `data/<key>/`:
@@ -41,6 +48,82 @@ restore anything it dropped or restamped.
41
  text, positive token counts, uniform source/license, stats-file consistency).
42
  Run `python3 -m pytest src/` before committing.
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ## Cut the release (the part that gets skipped)
45
 
46
  1. In `src/make_docs.py`: bump `VERSION` and `RELEASE_DATE`. Add a row for the new
 
22
  Never run `make_docs.py` and commit the result blind — `git diff` first and
23
  restore anything it dropped or restamped.
24
 
25
+ ## Before you start: check the findings log
26
+
27
+ `artifacts/source_findings.md` records sources already investigated, including
28
+ the rejected ones and *why*. Check it before spending a day on a source someone
29
+ already found to be blocked — and append your own finding there whether the
30
+ answer was yes or no.
31
+
32
  ## Add a source
33
 
34
  1. Produce the artifact under `data/<key>/`:
 
48
  text, positive token counts, uniform source/license, stats-file consistency).
49
  Run `python3 -m pytest src/` before committing.
50
 
51
+ ## What the PR must show
52
+
53
+ These two are not optional — they are the difference between a source a reviewer
54
+ can accept and one that sits in the queue. Treat every source PR as a worked
55
+ example other contributors will copy.
56
+
57
+ 1. **A sample of the data, inline in the PR description.** A few real documents
58
+ (or truncated ones), verbatim, so a reviewer can see at a glance what kind of
59
+ text this actually is — prose, transcripts, boilerplate, OCR noise, HTML
60
+ leftovers. Include the metadata columns too, not just `text`. Don't make the
61
+ reviewer download a parquet to find out.
62
+
63
+ 2. **Provenance and licensing, written out in the datasheet (`data/<key>/<key>.md`)
64
+ and summarized in the PR description:**
65
+ - Where the data comes from — the concrete origin (institution, portal, API,
66
+ dump), not just a domain name. Link it.
67
+ - Under what license, and **where that license statement lives** — link the
68
+ exact terms-of-use page, API docs section, or statute. "Public domain
69
+ because it's government data" is a claim, not a source; cite the provision.
70
+ - What the texts are — genre, register, time span, language variety, whether
71
+ they are OCR'd, machine-translated, or user-generated.
72
+ - How it was collected and filtered — dedup, minimum length, language ID,
73
+ anything dropped and why.
74
+ - The argument for inclusion — what this adds that the corpus does not
75
+ already have, and any known bias or quality caveat a downstream user should
76
+ weigh.
77
+
78
+ Yes, this is meta work on top of the fetching. That is the point: the datasheet
79
+ is the artifact other people read to learn how to contribute well.
80
+
81
+ ## Normalize the text before you build
82
+
83
+ `build_dynaword.py` applies only *minimal gates* — strip, `len < 200`, Polish
84
+ diacritic ratio, OCR alpha ratio, exact sha1 dedup. It does **not** clean text.
85
+ `src/normalize_schema.py` is a schema/stats tool despite the name; it never
86
+ touches `text`. So normalization is the fetcher's job, and today each fetcher
87
+ reimplements it (`fetch_govpl.py:43` and `fetch_saos.py:42` carry byte-identical
88
+ `html_to_text`; `clean_samorzad_gov_pl.py:65` a third variant). If you are
89
+ writing a new fetcher, factor the shared parts out rather than pasting a fourth
90
+ copy.
91
+
92
+ What a fetcher should do to `text` before writing the `.jsonl.zst`:
93
+
94
+ - **Unicode**: NFKC normalize. Map non-breaking/thin/zero-width spaces to plain
95
+ space (or drop), strip control characters and soft hyphens, normalize the
96
+ quote/dash/ellipsis zoo. Repair mojibake if the upstream encoding is unreliable.
97
+ - **Whitespace**: collapse runs of spaces/tabs, trim per line, cap blank runs at
98
+ one empty line. Do not flatten paragraph breaks — they carry structure.
99
+ - **Structural junk**: navigation, cookie banners, "share this", pagination,
100
+ footnote back-references, and — for OCR/PDF sources — page headers/footers,
101
+ running titles, and hyphenation split across line breaks.
102
+ - **Numbering**: strip standalone chapter/section/page numbers and repeated
103
+ heading numerals (`1.`, `Art. 5.`, `Rozdział III`) *only where they are layout
104
+ artifacts*. In `dziennik_ustaw` or `saos` the article numbering is content —
105
+ removing it destroys the document. Judge per source, and say what you did in
106
+ the datasheet.
107
+ - **Boilerplate**: near-identical blocks repeated across most documents of a
108
+ source (license footers, institutional disclaimers, "Pokaż odpowiedź"-style UI
109
+ chrome) should be detected by frequency across the shard and removed, not
110
+ hand-listed.
111
+ - **Personal data**: scrub before the parquet is written, not after. At minimum
112
+ email addresses, phone numbers, and national identifiers (PESEL, NIP, REGON,
113
+ account numbers). Replace with a stable placeholder (`[PII]`, `[Telefon]`)
114
+ rather than deleting, so sentence structure survives. Names of public
115
+ officials acting in an official capacity are not PII and should stay —
116
+ removing them would gut parliamentary and judicial sources.
117
+
118
+ Two rules about all of the above:
119
+
120
+ 1. **The normalization must live in the committed fetch/clean script**, so the
121
+ shard is reproducible. A shard whose datasheet describes a cleaning step that
122
+ no script in `src/` performs is not reproducible, however good the intent.
123
+ 2. **Report it in the datasheet**: which steps ran, and what the gates dropped.
124
+ Include a handful of before/after excerpts in the PR — this is the fastest way
125
+ for a reviewer to see whether normalization ate real content.
126
+
127
  ## Cut the release (the part that gets skipped)
128
 
129
  1. In `src/make_docs.py`: bump `VERSION` and `RELEASE_DATE`. Add a row for the new
artifacts/source_findings.md ADDED
@@ -0,0 +1,543 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Source investigation findings
2
+
3
+ Running log of sources that were investigated, whether or not they were added.
4
+ **Append-only, version-independent** — unlike the `*_v0_3.md` artifacts, which are
5
+ point-in-time snapshots of one release's candidate review.
6
+
7
+ Purpose: stop the same source being re-investigated from scratch every few months.
8
+ A negative finding is as valuable as a positive one, as long as it records *what
9
+ was checked* and *what would change the answer*.
10
+
11
+ Related, don't duplicate:
12
+ - `source_scouting_v0_3.md` — v0.3 candidate shortlist (HuggingFace-centric)
13
+ - `source_candidate_audit_v0_3.md` — machine-generated audit of those HF cards
14
+ - `source_license_review_v0_3.md` — v0.3 license decision table
15
+
16
+ ## How to add an entry
17
+
18
+ One `##` section per source. Keep these fields:
19
+
20
+ - **Investigated** — date, so a stale finding is visible as stale.
21
+ - **Verdict** — `added` / `blocked` / `hold` / `rejected`, plus the one-line reason.
22
+ - **Enumeration** — how you would actually get the data, or why you can't.
23
+ - **License evidence** — what you checked, with URLs. Separate what you *verified
24
+ yourself* from what you read second-hand; label the weak ones.
25
+ - **Blockers** — what must be resolved before this can ship.
26
+ - **Lesson** — anything generalizable to other sources. Optional.
27
+
28
+ Write down the API endpoints and quirks you had to dig for. That digging is the
29
+ expensive part, and it is invisible in a verdict line.
30
+
31
+ ---
32
+
33
+ ## zpe.gov.pl — Zintegrowana Platforma Edukacyjna
34
+
35
+ **Investigated:** 2026-08-27
36
+ **Verdict:** `hold` — technically very tractable, blocked on per-material license
37
+ evidence. Do not build a fetcher until the license question below is answered.
38
+
39
+ Ministry of Education platform (successor to `epodreczniki.pl`), e-materials
40
+ across all school subjects. Attractive because the corpus has **no modern
41
+ instructional/pedagogic register at all**, and this is contemporary, clean,
42
+ editorially reviewed Polish prose.
43
+
44
+ ### Enumeration — solved
45
+
46
+ There is no sitemap (`/sitemap.xml` → 404) and site search is client-side, but
47
+ `https://zpe.gov.pl/config.js` exposes an undocumented JSON API:
48
+
49
+ ```
50
+ window.CP_CONFIGURATION = {... "apiUrl":"https://zpe.gov.pl/api/v1/" ...}
51
+ ```
52
+
53
+ ```
54
+ GET https://zpe.gov.pl/api/v1/search?query=&limit=20&offset=N
55
+ → {"count": 23843, "offset": 0, "limit": 20,
56
+ "data": [{"id": "P18l4AKOi", "title": "Fotosynteza",
57
+ "subject": [...], "stage": [...], "tags": [], ...}]}
58
+ ```
59
+
60
+ Verified directly (2026-08-27):
61
+
62
+ - `count` = **23,843** materials for the empty query.
63
+ - Deep paging works — `offset=5000` returns rows, no cursor needed.
64
+ - `robots.txt` is `User-agent: * / Allow: /`.
65
+ - Article pages `/a/<slug>/<CODE>` are **fully server-rendered**; text lives in
66
+ `data-editor-content` blocks. No JS execution required to extract prose.
67
+ - Book pages `/b/<slug>/<CODE>` render their material list client-side (0
68
+ server-side `/a/` links), so `/b/` is useless for crawling. Use the API.
69
+
70
+ Other endpoints probed and 404: `api/v1/materials`, `api/v1/document(s)/<CODE>`,
71
+ `api/v1/footer`, `api/v1/menu`, `api/v1/search/materials`. Only
72
+ `api/v1/search?query=` responded.
73
+
74
+ ### License evidence — the blocker
75
+
76
+ **Verified directly:**
77
+
78
+ - **No document-level license marker exists in the served HTML.** The only
79
+ machine-readable license strings are per-figure, inside
80
+ `<div class="figure_caption_bibliography">`, e.g.
81
+ `Źródło: GroMar, licencja: CC BY 3.0.` and
82
+ `Źródło: Sławomir Szaruga, licencja: CC BY 3.0.` These attach to
83
+ **illustrations, not to the prose**.
84
+ - **The site footer is `<div id="footer_app"></div>` — JS-rendered.** This
85
+ matters: the accepted legal basis for both `govpl` and `samorzad_gov_pl` in
86
+ `src/sources.py` is a *server-side footer string* declaring CC BY-SA 4.0.
87
+ ZPE has no such string. **That precedent does not transfer to ZPE.**
88
+ - The platform `regulamin` states:
89
+ *"Korzystanie z Materiału odbywać się może tylko i wyłącznie w zakresie
90
+ dozwolonym przepisami ustawy o prawie autorskim i prawach pokrewnych"* —
91
+ statutory permitted-use only, which is not an open license. Reading the
92
+ surrounding clauses, this section appears scoped to material *uploaded by
93
+ users to* the platform rather than to ministry e-materials, but the wording is
94
+ not self-limiting and a reviewer will land on it.
95
+
96
+ **Second-hand, not verified — confirm before relying on any of it:**
97
+
98
+ - Ministry-produced e-materials are said to be CC BY 3.0, funded under
99
+ POKL 2007–2013 / POWER 2014–2020.
100
+ - User-contributed materials are reported to carry **CC BY-NC-SA 4.0**. NC is
101
+ already on the reject list (`source_scouting_v0_3.md`), so those must be
102
+ excluded, not merely flagged.
103
+ - Literary works embedded in e-materials are reported to sit under a
104
+ non-free *"licencja edukacyjna"* where authors or heirs did not agree to open
105
+ release. This is the highest-risk content class on the platform.
106
+
107
+ ### Consequences for design
108
+
109
+ - ZPE cannot be a single-license shard. It has to be **per-record license-gated**,
110
+ `license_spdx: MIXED`, same shape as `biblioteka_nauki` and `europeana`.
111
+ - Available heuristic, **not** license evidence: ministry materials come back with
112
+ `subject` and `stage` populated; user uploads return `"subject": [], "stage": []`
113
+ (the first empty-query result is an all-caps user upload with both empty). Usable
114
+ as a pre-filter, useless as provenance.
115
+ - Rough size if ~10–15k ministry materials survive the gate: **~30–100M tokens**.
116
+ Estimate only — nothing was counted. Good register, modest scale.
117
+
118
+ ### Extraction hazards (seen in a single sampled page)
119
+
120
+ - Interactive-exercise chrome: `Pokaż podpowiedź`, `Pokaż odpowiedź` buttons.
121
+ - JSON blobs embedded in `data-editor-params` attributes (`gameTitle`,
122
+ `feedbackPositive`, …) — must not leak into `text`.
123
+ - Per-figure attribution lines repeated throughout the body.
124
+ - Glossary / `Zapamiętaj!` boilerplate repeated across many materials — needs
125
+ frequency-based boilerplate detection, not a hand-written blocklist.
126
+
127
+ ### What would unblock this
128
+
129
+ Any one of: a resolvable per-material license field (API or page markup); an
130
+ authoritative ORE/MEN page granting open reuse of e-material *text*; or written
131
+ permission. Absent that, ZPE stays out — the datasheet could not honestly answer
132
+ "where does the license statement live", which is a required field for any PR.
133
+
134
+ ### Lesson
135
+
136
+ Check for a **server-rendered** license statement early. A JS-rendered footer is
137
+ not usable license evidence, and "it's a `gov.pl` domain" is not a license — the
138
+ `govpl` and `samorzad_gov_pl` entries hold up because a specific footer string
139
+ was fetched and quoted, not because of the domain.
140
+
141
+ ---
142
+
143
+ ## ParlaMint-PL — parliamentary debates 2015–2022
144
+
145
+ **Investigated:** 2026-08-27
146
+ **Verdict:** `ready to build, low yield` — license and distribution verified, the
147
+ fetcher is the only missing piece. But it is a **date-hole patch worth ~36M
148
+ net-new tokens**, not a diversity win. Size it before prioritising it.
149
+
150
+ Already registered in `src/sources.py` as `parlamint_pl`, but there is **no shard
151
+ in `data/`**.
152
+
153
+ ### Size — measured, not guessed
154
+
155
+ From the official stats at
156
+ `github.com/clarin-eric/ParlaMint/tree/v5.0/Build/Metadata`
157
+ (`ParlaMint-overview-stats.tsv`, `ParlaMint-speeches-stats.tsv`):
158
+
159
+ ```
160
+ ID Lang Bodies Ts From To Yrs Mw/Yr Mw
161
+ PL pl low+upp 4 2015-11 2022-06 6.7 5.35 36.06
162
+ ```
163
+
164
+ - **36.06M words**, **228,326 speeches**, 4 terms, both chambers.
165
+ - Token conversion measured on our own `parliamentary` shard (same register, same
166
+ cl100k encoder; 6,000 docs / 9.7M words): **2.654 tokens/word**, 7.24 chars/word.
167
+ - → **~96M tokens gross**, ≈1% of the current 9.68B corpus.
168
+ - Download: `ParlaMint-PL.tgz`, 185.3 MB.
169
+
170
+ ### Overlap with the existing `parliamentary` shard — the real issue
171
+
172
+ ParlaMint-PL is **derived from PPC**, which is exactly what the `parliamentary`
173
+ shard is (1991–2019). Time overlap runs 2015-11 → 2019-12, about 4.2 of the 6.7
174
+ years, ≈22M words likely already present. **Net new ≈ 14M words ≈ 36M tokens**,
175
+ covering 2020-01 → 2022-06.
176
+
177
+ That estimate is soft in both directions:
178
+
179
+ - `parliamentary` has **no per-document dates** — `created` is the single literal
180
+ `'1991-01-01, 2019-12-31'` on all 324,622 rows. The overlap cannot be measured
181
+ by filtering, only by comparing content.
182
+ - PPC includes committee sittings and interpellations; ParlaMint-PL is plenary
183
+ only. So ParlaMint's 2015–2019 portion is plausibly a *subset* of what already
184
+ ships, making the real overlap higher than the time-share implies.
185
+
186
+ **Exact dedup will not catch this.** `build_dynaword.py` dedups on `sha1` of the
187
+ whole document. ParlaMint ships one document per session; PPC's segmentation
188
+ differs, so byte-identical documents are unlikely and the duplicates pass
189
+ straight through the gate. This needs **near-dedup, for which the repo has no
190
+ committed tooling** — the HPLT expansion's near-dedup was run outside `src/`.
191
+ Budget for that, or the shard silently duplicates existing data.
192
+
193
+ ### Version note
194
+
195
+ **ParlaMint 5.0 does not extend Polish** — PL still ends 2022-06, same as the 3.0
196
+ deposit already cited in `sources.py` (handle `11356/1486`; 5.0 is `11356/2004`).
197
+ Upgrading buys corrections, not coverage. Neither version closes the gap to
198
+ `sejm_api` (2023 onward): mid-2022 through end-2022 stays empty.
199
+
200
+ ### Verified
201
+
202
+ - CLARIN.SI handle `11356/1486` resolves (HTTP 200). The `upstream` URL recorded
203
+ in `sources.py` is correct and live.
204
+ - License: **CC BY 4.0**, stated on the repository record.
205
+ - ParlaMint 3.0 overall: 26 comparable corpora, 7,468,674 utterances,
206
+ 1,147,800,265 words; debates mostly 2015 → mid-2022.
207
+ - The distribution ships a **plain-text (`.txt`) edition** alongside TEI/XML and
208
+ linguistically-annotated `.ana.xml`. Filenames are per-session, e.g.
209
+ `ParlaMint-PL_2017-07-20-sejm-46-3.txt`. Use the `.txt` edition — no TEI parsing
210
+ needed.
211
+ - Polish covers **both chambers**: `-sejm-` and `-senat-` session files.
212
+
213
+ ### Why it is still worth doing
214
+
215
+ Fills 2020 → mid-2022, between `parliamentary` (ends 2019) and `sejm_api` (2023
216
+ onward). Same CC-BY-4.0 family as existing sources, so there is no new license
217
+ question to answer, and the plain-text edition means no TEI parsing. Cheap. Just
218
+ do not expect it to move the totals — and do not build it before a source that
219
+ adds a register the corpus lacks.
220
+
221
+ ### Drift found while checking
222
+
223
+ `src/sources.py` (the `parlamint_pl` `provenance` field) states the corpus was
224
+ *"Fetched directly from the CLARIN.SI plain-text edition (ParlaMint-PL.tgz) by
225
+ `src/fetch_parlamint.py`"*. **That script does not exist in `src/`.** The
226
+ provenance describes a fetch that no committed code performs. Either write the
227
+ script or correct the field before this ships.
228
+
229
+ ---
230
+
231
+ ## Sejm API — interpelacje and zapytania poselskie
232
+
233
+ **Investigated:** 2026-08-27
234
+ **Verdict:** `hold — recheck`. Not a license problem; `api.sejm.gov.pl` was
235
+ unreachable from the investigating network on the day, so the endpoints could not
236
+ be confirmed. Retry before writing anything off.
237
+
238
+ ### What happened
239
+
240
+ - `api.sejm.gov.pl` resolves (`194.41.12.231`) but every request hangs and then
241
+ fails — plain `curl` times out at 45s, a proxied fetch returns `ECONNRESET`.
242
+ - `https://www.sejm.gov.pl/` responds normally (302), and other external hosts
243
+ were fine the same session, so this is specific to the API host: either an
244
+ outage, or that host filtering the source network.
245
+ - `src/fetch_sejm_api.py` (committed, working) uses this same host, so the API
246
+ is normally reachable. Treat as transient until proven otherwise.
247
+
248
+ ### Unverified — what to check on retry
249
+
250
+ - Whether `sejm/term{N}/interpellations` and `sejm/term{N}/writtenQuestions`
251
+ exist, and their paging parameters.
252
+ - Whether the **ministry's reply body** is retrievable as text, or only as a
253
+ linked PDF. This decides whether the source is worth building: the replies are
254
+ the substantial half.
255
+ - Document counts per term.
256
+
257
+ ### Why it is on the list
258
+
259
+ Reuses the existing `fetch_sejm_api.py` legal basis unchanged — official
260
+ parliamentary materials outside copyright under art. 4(2) pr. aut., reusable
261
+ under the Open Data Act. Question/answer prose is argumentative register, which
262
+ the corpus is short on. No new license work needed.
263
+
264
+ ---
265
+
266
+ ## CLARIN-PL DSpace (PELCRA Spokes, and the `1000_novels` upstream)
267
+
268
+ **Investigated:** 2026-08-27
269
+ **Verdict:** `blocked — temporary`. The repository is down for reorganization.
270
+ Nothing to decide until it returns.
271
+
272
+ ### Verified
273
+
274
+ - `https://clarin-pl.eu/dspace/` serves a maintenance notice:
275
+ *"Trwają prace nad repozytorium. Prowadzimy prace serwisowe oraz reorganizację
276
+ repozytorium DSpace… Repozytorium będzie ponownie dostępne wkrótce."*
277
+ - Every item handle under it 404s: `11321/312`, `11321/544`, `11321/545`,
278
+ `11321/547` — nginx 404, not a DSpace "item not found".
279
+ - The global resolver is broken for this prefix too: `hdl.handle.net/11321/*`
280
+ returns **HTTP 500**.
281
+
282
+ So no PELCRA record (Spokes, EMO, PARL, EMI) can have its license checked right
283
+ now. Conversational Polish remains the corpus's biggest register gap, so this is
284
+ worth re-checking periodically.
285
+
286
+ ### Side effect on shipped data
287
+
288
+ `src/sources.py` records `https://clarin-pl.eu/dspace/handle/11321/312` as the
289
+ `upstream` for **`1000_novels`**, which is a released shard. That URL currently
290
+ does not resolve. Presumed temporary, but the citation in a published datasheet
291
+ is dead as of this date.
292
+
293
+ ### Expected concern when it returns
294
+
295
+ PELCRA spoken corpora are transcribed private conversation. Expect NC-flavoured
296
+ or restricted licensing, and expect a personal-data question — these recordings
297
+ involve identifiable private individuals, not public officials acting officially.
298
+ Both must be resolved before use.
299
+
300
+ ---
301
+
302
+ ## NIK — Najwyższa Izba Kontroli audit reports
303
+
304
+ **Investigated:** 2026-08-27
305
+ **Verdict:** `hold` — permissive but **non-standard** license, and enumeration is
306
+ unsolved. Viable with work; not a quick win.
307
+
308
+ ### License evidence — verified
309
+
310
+ `https://www.nik.gov.pl/zasady/prawa-autorskie.html` states:
311
+
312
+ > *"Korzystanie z materiałów publikowanych w serwisach internetowych Najwyższej
313
+ > Izby Kontroli nie wymaga uzyskania zgody NIK. Nie dotyczy to elementów odrębnie
314
+ > zastrzeżonych (do których prawa autorskie przysługują osobom trzecim), w
315
+ > szczególności oznaczonych materiałów zdjęciowych oraz tekstów publikowanych
316
+ > pierwotnie w innych źródłach."*
317
+
318
+ Attribution to *"Najwyższa Izba Kontroli (nik.gov.pl)"* is requested, not required.
319
+
320
+ Assessment: a **custom permissive notice, not a standard open license** — no CC,
321
+ no CC0, no SPDX identifier. It carries a third-party carve-out that matters here,
322
+ because audit reports quote external sources. A separate and probably stronger
323
+ argument is that audit reports are *materiały urzędowe* under art. 4 pkt 2 pr.
324
+ aut., the same basis as `dziennik_ustaw` and `sejm_api`. If this source is built,
325
+ lead with the statutory argument and cite the site notice as corroboration.
326
+
327
+ ### Enumeration — unsolved
328
+
329
+ - `robots.txt` allows crawling, but disallows `/szukaj/`, `/p/`, `/g2/`,
330
+ `/cms/`, `/do_druku/`. `/g2/` looks like the file store, which likely means
331
+ **report PDFs are off-limits to crawlers**.
332
+ - `/kontrole/wyniki-kontroli-nik/` returns 200 (~72 kB) but the report list is
333
+ **JS-rendered**: zero report links in the server HTML, only pagination
334
+ scaffolding (`fmax,js,strona,1.html`).
335
+ - The `/prosta/` ("simple") variant is also JS-rendered — 0 report links.
336
+ - No `/sitemap.xml` (404).
337
+
338
+ Same shape as ZPE: a backend API almost certainly exists and would need to be
339
+ found (check the page's JS config for an `apiUrl`, as worked for ZPE).
340
+
341
+ ### Verdict rationale
342
+
343
+ Register value is real — long-form analytical prose, unlike statute text. But
344
+ between a bespoke license, a third-party-content carve-out, PDF paths blocked by
345
+ `robots.txt`, and unsolved enumeration, this is several days of work. Lower
346
+ priority than ParlaMint-PL or Sejm interpelacje.
347
+
348
+ ---
349
+
350
+ ## Billion-scale survey — what can actually move the totals
351
+
352
+ **Investigated:** 2026-08-27
353
+
354
+ Context: most candidates land at 30–200M tokens, which is noise against a 9.68B
355
+ corpus. This entry records the only options measured at **500M–5B**, i.e.
356
+ comparable to `european_hplt_v3_pl` (2.56B), `eurlex` (2.38B), `parliamentary`
357
+ (1.65B). All numbers below were measured on the day, not taken from cards.
358
+
359
+ Token conversion throughout: **2.654 tokens/word**, measured on the repo's own
360
+ `parliamentary` shard (6,000 docs / 9.7M words, cl100k). Use it instead of
361
+ guessing — Polish runs far above the ~1.3 rule of thumb for English.
362
+
363
+ | candidate | measured | est. tokens | license | blocker |
364
+ |---|---|---|---|---|
365
+ | SAOS judgments | 540,338 docs, mean 3,067 w | **~4.4B** (floor ~2.8B) | art. 4 pkt 2 pr. aut. | register: pure legal |
366
+ | FineWeb-2 `pol_Latn` | 152,003,298 docs, 225.9 GB | ~83B raw, **4–8B** filtered | ODC-By | dedup vs existing HPLT |
367
+ | PleIAs/Polish-PD | 68,176 docs, 0.75B words | **~2.0B** nominal | public domain | OCR corruption |
368
+ | HPLT leftovers | shards `8_5`, `8_6`, 31.6 GB | ~230M | CC0 | none — just small |
369
+
370
+ ### SAOS — biggest clean win, already half-built
371
+
372
+ `https://www.saos.org.pl/api/search/judgments?pageSize=1&pageNumber=0` reports
373
+ `totalResults: 540338`. Sampled 100 judgments from
374
+ `api/dump/judgments?pageSize=100&pageNumber=0`: **mean 3,067 words, median 1,920,
375
+ p10 816, p90 7,197**, court types `COMMON` and `CONSTITUTIONAL_TRIBUNAL`.
376
+
377
+ 540,338 × 3,067 = 1.66B words → **~4.4B tokens**. Using the median instead, to
378
+ guard against long-tail skew, still gives ~2.75B. Either way this is **larger
379
+ than any shard currently in the corpus**.
380
+
381
+ `src/fetch_saos.py` already exists (uncommitted as of this date) and documents the
382
+ legal basis: judgments are *materiały urzędowe* outside copyright under art. 4
383
+ pkt 2 pr. aut., redistributed by SAOS (CeON/ICM UW + Fundacja ePaństwo) through a
384
+ bulk-dump API built for exactly this.
385
+
386
+ Open question before building: judgments are court-anonymised, but that should be
387
+ **verified on sampled text**, not assumed — this is the one candidate here where
388
+ personal data is a live risk rather than a formality.
389
+
390
+ Cost of shipping it: legal/official goes from **48% to roughly 65%** of the
391
+ corpus. That is the trade, and it should be a deliberate decision rather than a
392
+ side effect of it being the easy build.
393
+
394
+ ### FineWeb-2 Polish — only billion-scale contemporary prose
395
+
396
+ `datasets-server` size endpoint, config `pol_Latn`: **152,003,298 rows /
397
+ 225.9 GB**. At the measured 0.367 tokens/char that is **~83B tokens raw**.
398
+
399
+ License `odc-by`. Same argument shape as the accepted HPLT basis: the packaging
400
+ is licensed, the underlying web text is not owned by the publisher. Note that
401
+ ODC-By is **attribution-required**, unlike HPLT's CC0 — a different obligation
402
+ shape, and it has to be stated in the datasheet.
403
+
404
+ #### Dedup is not the bottleneck — this was checked, not assumed
405
+
406
+ The obvious worry is overlap with the existing HPLT shard, since both derive from
407
+ Common Crawl. It is the *smallest* of the problems:
408
+
409
+ - The existing HPLT shard is **1.6M docs against FineWeb-2's 152M**. Even total
410
+ overlap removes ~1% of candidates (~12% if working from the HQ subset below).
411
+ - **Internal dedup is already done upstream.** The schema carries
412
+ `minhash_cluster_size`, i.e. FineWeb-2 ran MinHash per language before release.
413
+
414
+ Cross-dedup against HPLT is still worth doing for hygiene, and the repo still has
415
+ no committed near-dedup tooling — but it is not what makes this source expensive.
416
+
417
+ #### The actual blocker: the HPLT gate cannot be ported
418
+
419
+ FineWeb-2 `pol_Latn` columns are:
420
+
421
+ ```
422
+ text, id, dump, url, date, file_path, language,
423
+ language_score, language_script, minhash_cluster_size, top_langs
424
+ ```
425
+
426
+ `src/clean_hplt_v3.py` filters on **WDS quality score, register class
427
+ (ID/OP/HI/IN/NA), and MT-probability**. *None of those exist in FineWeb-2.* Every
428
+ signal the existing web pipeline depends on is absent, so "filter it like we
429
+ filtered HPLT" is not an option — it would mean building quality classification
430
+ over 152M documents from scratch.
431
+
432
+ #### `epfml/FineWeb2-HQ` — the better target
433
+
434
+ A published quality-filtered derivative, config `pol_Latn`:
435
+
436
+ - **13,384,885 rows**, `odc-by`, 180.4 GB parquet (size dominated by an
437
+ `embeddings` column, not text).
438
+ - Adds a **`quality_score`** column, retained per document, so the selection
439
+ threshold stays a tunable knob instead of a baked-in decision — and the
440
+ classifier is someone else's published work, which is easier to cite than a
441
+ home-grown one.
442
+ - Sampled 880 docs across 22 evenly-spread offsets: **mean 2,663 chars/doc**
443
+ → ~13.1B tokens for the whole HQ subset. Larger than the entire current corpus.
444
+
445
+ #### quality_score → token yield
446
+
447
+ Distribution from the `statistics` endpoint (computed on a **partial 407,184-row
448
+ sample**, not all 13.4M): min 0.013, max 0.9999, mean 0.145, **median 0.0496** —
449
+ heavily right-skewed, so most of HQ still scores low.
450
+
451
+ Doc fractions from that histogram, mean lengths from the 880-doc sample:
452
+
453
+ | `quality_score` ≥ | % docs | docs | mean chars | est. tokens |
454
+ |---|---:|---:|---:|---:|
455
+ | 0.00 (all) | 100% | 13,384,885 | 2,663 | **13.1B** |
456
+ | 0.11 | 31.0% | 4,149,000 | 2,375 | **3.6B** |
457
+ | 0.21 | 20.0% | 2,677,000 | 2,074 | **2.0B** |
458
+ | 0.31 | 14.6% | 1,954,000 | 1,929 | **1.4B** |
459
+ | 0.41 | 11.1% | 1,486,000 | 1,912 | **1.0B** |
460
+ | 0.51 | 8.5% | 1,138,000 | 1,798 | **0.75B** |
461
+ | 0.70 | 4.8% | 642,000 | 1,750 | **0.41B** |
462
+ | 0.90 | 1.8% | 241,000 | 914 | **0.08B** |
463
+
464
+ A second pass computing fractions directly from the 880-doc sample agreed with
465
+ these within ~15%. Treat them as ±20%, good enough to pick a threshold.
466
+
467
+ **Watch out: `quality_score` anti-correlates with document length.** Mean length
468
+ falls from 2,663 chars at no threshold to 914 at ≥0.90. The classifier is not
469
+ rewarding long-form prose, so raising the threshold costs more tokens than the
470
+ doc-count alone implies, and it may actively select *against* the extended prose
471
+ this corpus is short on. Sample the text at whatever threshold is chosen before
472
+ committing to it.
473
+
474
+ #### Recommended operating point
475
+
476
+ **Threshold ≈ 0.20 → ~2.7M docs, ~2.0–2.3B tokens.** Comparable to the largest
477
+ existing shards (`european_hplt_v3_pl` 2.56B, `eurlex` 2.38B) and it *improves*
478
+ the balance rather than wrecking it: web goes 26% → ~41%, legal drops 48% → ~39%.
479
+
480
+ Taking all 13.1B instead would put the corpus at ~22.7B with **web at ~69%** —
481
+ trading "two-thirds legalese" for "two-thirds crawl". Same failure, different axis.
482
+
483
+ #### Work order if this is built
484
+
485
+ 1. Pick HQ vs full, and a `quality_score` threshold (see above).
486
+ 2. **Build the PII scrub.** `sources.py` already claims one for the HPLT shard
487
+ that has no implementing code in `src/`; shipping a second web source with the
488
+ same gap is indefensible.
489
+ 3. Near-dedup against the existing HPLT shard — needed, but ~1–12% effect.
490
+ 4. Compute. Tokenizing billions of tokens is the genuinely expensive step.
491
+
492
+ ### PleIAs/Polish-PD — good on paper, rough in practice
493
+
494
+ 68,176 rows. Sampled `word_count` at four offsets (n=200): **mean 10,971 words,
495
+ median 8,468** → ~0.75B words → **~2.0B tokens**. Columns are `identifier`,
496
+ `file`, `title`, `creator`, `language`, `word_count`, `character_count`,
497
+ `complete_text`. Public domain, pre-1884 monographs and periodicals, largely
498
+ sourced from Polish digital libraries (`jbc.bj.uj.edu.pl` in the sample).
499
+
500
+ Register-wise this is the most attractive of the three — books and periodicals,
501
+ against a corpus that is only 1.9% literature.
502
+
503
+ But the OCR is bad. First sampled record (an 1817 newspaper) opens:
504
+
505
+ ```
506
+ U
507
+ RUSKI
508
+ czwaRTEŁ SONAER
509
+ 5 PC Nę R
510
+ WIADOMOŚC
511
+ ```
512
+
513
+ with pre-1884 orthography throughout (`Nayiaśnieyszy`, `roskazać`, `klassy`).
514
+
515
+ **The existing OCR gate will not catch this.** `build_dynaword.py` applies
516
+ `MIN_ALPHA_RATIO = 0.70` when `is_ocr: True`, which tests the ratio of letters to
517
+ symbols. Garbled *words* made of ordinary letters pass it cleanly. Filtering this
518
+ source needs a dictionary- or perplexity-based check, which does not exist here.
519
+ Treat the 2.0B as nominal; real usable yield is materially lower.
520
+
521
+ ### HPLT is exhausted — correction to an earlier assumption
522
+
523
+ `https://data.hplt-project.org/three/sorted/pol_Latn/` lists **exactly 19 shards**:
524
+ `10_1`, `9_1`–`9_4`, `8_1`–`8_6`, `7_1`–`7_4`, `6_1`–`6_2`, `5_1`–`5_2`.
525
+ **There are no WDS bins below 5 for Polish.**
526
+
527
+ `sources.py` records 17 of those as ingested. The only unused shards are
528
+ **`8_5` (24.24 GB)** and **`8_6` (7.37 GB)** — roughly 230M tokens at the
529
+ post-filter rate implied by the existing shard.
530
+
531
+ So "add more HPLT bins" is not a path to billions. It is one small top-up, and
532
+ then the source is finished.
533
+
534
+ ### Conclusion
535
+
536
+ Every clean billion-scale Polish source is **legal, official, or archaic** —
537
+ which follows directly from what falls outside copyright. The only billion-scale
538
+ contemporary general prose is web crawl, and that is a re-derivation of Common
539
+ Crawl the corpus already draws on.
540
+
541
+ If the goal is raw scale: SAOS. If the goal is a corpus that is not two-thirds
542
+ legalese, **there is no billion-scale option**, and the honest plan is a number of
543
+ 50–200M-token sources across different registers.