polish-dynaword / artifacts /source_findings.md
kacperwikiel's picture
Contributor guidance: source findings log + PR/normalization requirements (#17)
a9d134a
|
Raw History Blame
25.3 kB

Source investigation findings

Running log of sources that were investigated, whether or not they were added. Append-only, version-independent — unlike the *_v0_3.md artifacts, which are point-in-time snapshots of one release's candidate review.

Purpose: stop the same source being re-investigated from scratch every few months. A negative finding is as valuable as a positive one, as long as it records what was checked and what would change the answer.

Related, don't duplicate:

  • source_scouting_v0_3.md — v0.3 candidate shortlist (HuggingFace-centric)
  • source_candidate_audit_v0_3.md — machine-generated audit of those HF cards
  • source_license_review_v0_3.md — v0.3 license decision table

How to add an entry

One ## section per source. Keep these fields:

  • Investigated — date, so a stale finding is visible as stale.
  • Verdict — added / blocked / hold / rejected, plus the one-line reason.
  • Enumeration — how you would actually get the data, or why you can't.
  • License evidence — what you checked, with URLs. Separate what you verified yourself from what you read second-hand; label the weak ones.
  • Blockers — what must be resolved before this can ship.
  • Lesson — anything generalizable to other sources. Optional.

Write down the API endpoints and quirks you had to dig for. That digging is the expensive part, and it is invisible in a verdict line.


zpe.gov.pl — Zintegrowana Platforma Edukacyjna

Investigated: 2026-08-27 Verdict: hold — technically very tractable, blocked on per-material license evidence. Do not build a fetcher until the license question below is answered.

Ministry of Education platform (successor to epodreczniki.pl), e-materials across all school subjects. Attractive because the corpus has no modern instructional/pedagogic register at all, and this is contemporary, clean, editorially reviewed Polish prose.

Enumeration — solved

There is no sitemap (/sitemap.xml → 404) and site search is client-side, but https://zpe.gov.pl/config.js exposes an undocumented JSON API:

window.CP_CONFIGURATION = {... "apiUrl":"https://zpe.gov.pl/api/v1/" ...}
GET https://zpe.gov.pl/api/v1/search?query=&limit=20&offset=N
→ {"count": 23843, "offset": 0, "limit": 20,
   "data": [{"id": "P18l4AKOi", "title": "Fotosynteza",
             "subject": [...], "stage": [...], "tags": [], ...}]}

Verified directly (2026-08-27):

  • count = 23,843 materials for the empty query.
  • Deep paging works — offset=5000 returns rows, no cursor needed.
  • robots.txt is User-agent: * / Allow: /.
  • Article pages /a/<slug>/<CODE> are fully server-rendered; text lives in data-editor-content blocks. No JS execution required to extract prose.
  • Book pages /b/<slug>/<CODE> render their material list client-side (0 server-side /a/ links), so /b/ is useless for crawling. Use the API.

Other endpoints probed and 404: api/v1/materials, api/v1/document(s)/<CODE>, api/v1/footer, api/v1/menu, api/v1/search/materials. Only api/v1/search?query= responded.

License evidence — the blocker

Verified directly:

  • No document-level license marker exists in the served HTML. The only machine-readable license strings are per-figure, inside <div class="figure_caption_bibliography">, e.g. Źródło: GroMar, licencja: CC BY 3.0. and Źródło: Sławomir Szaruga, licencja: CC BY 3.0. These attach to illustrations, not to the prose.
  • The site footer is <div id="footer_app"></div> — JS-rendered. This matters: the accepted legal basis for both govpl and samorzad_gov_pl in src/sources.py is a server-side footer string declaring CC BY-SA 4.0. ZPE has no such string. That precedent does not transfer to ZPE.
  • The platform regulamin states: "Korzystanie z Materiału odbywać się może tylko i wyłącznie w zakresie dozwolonym przepisami ustawy o prawie autorskim i prawach pokrewnych" — statutory permitted-use only, which is not an open license. Reading the surrounding clauses, this section appears scoped to material uploaded by users to the platform rather than to ministry e-materials, but the wording is not self-limiting and a reviewer will land on it.

Second-hand, not verified — confirm before relying on any of it:

  • Ministry-produced e-materials are said to be CC BY 3.0, funded under POKL 2007–2013 / POWER 2014–2020.
  • User-contributed materials are reported to carry CC BY-NC-SA 4.0. NC is already on the reject list (source_scouting_v0_3.md), so those must be excluded, not merely flagged.
  • Literary works embedded in e-materials are reported to sit under a non-free "licencja edukacyjna" where authors or heirs did not agree to open release. This is the highest-risk content class on the platform.

Consequences for design

  • ZPE cannot be a single-license shard. It has to be per-record license-gated, license_spdx: MIXED, same shape as biblioteka_nauki and europeana.
  • Available heuristic, not license evidence: ministry materials come back with subject and stage populated; user uploads return "subject": [], "stage": [] (the first empty-query result is an all-caps user upload with both empty). Usable as a pre-filter, useless as provenance.
  • Rough size if 10–15k ministry materials survive the gate: **30–100M tokens**. Estimate only — nothing was counted. Good register, modest scale.

Extraction hazards (seen in a single sampled page)

  • Interactive-exercise chrome: Pokaż podpowiedź, Pokaż odpowiedź buttons.
  • JSON blobs embedded in data-editor-params attributes (gameTitle, feedbackPositive, …) — must not leak into text.
  • Per-figure attribution lines repeated throughout the body.
  • Glossary / Zapamiętaj! boilerplate repeated across many materials — needs frequency-based boilerplate detection, not a hand-written blocklist.

What would unblock this

Any one of: a resolvable per-material license field (API or page markup); an authoritative ORE/MEN page granting open reuse of e-material text; or written permission. Absent that, ZPE stays out — the datasheet could not honestly answer "where does the license statement live", which is a required field for any PR.

Lesson

Check for a server-rendered license statement early. A JS-rendered footer is not usable license evidence, and "it's a gov.pl domain" is not a license — the govpl and samorzad_gov_pl entries hold up because a specific footer string was fetched and quoted, not because of the domain.


ParlaMint-PL — parliamentary debates 2015–2022

Investigated: 2026-08-27 Verdict: ready to build, low yield — license and distribution verified, the fetcher is the only missing piece. But it is a date-hole patch worth ~36M net-new tokens, not a diversity win. Size it before prioritising it.

Already registered in src/sources.py as parlamint_pl, but there is no shard in data/.

Size — measured, not guessed

From the official stats at github.com/clarin-eric/ParlaMint/tree/v5.0/Build/Metadata (ParlaMint-overview-stats.tsv, ParlaMint-speeches-stats.tsv):

ID  Lang  Bodies   Ts  From     To       Yrs  Mw/Yr  Mw
PL  pl    low+upp  4   2015-11  2022-06  6.7  5.35   36.06
  • 36.06M words, 228,326 speeches, 4 terms, both chambers.
  • Token conversion measured on our own parliamentary shard (same register, same cl100k encoder; 6,000 docs / 9.7M words): 2.654 tokens/word, 7.24 chars/word.
  • → ~96M tokens gross, ≈1% of the current 9.68B corpus.
  • Download: ParlaMint-PL.tgz, 185.3 MB.

Overlap with the existing parliamentary shard — the real issue

ParlaMint-PL is derived from PPC, which is exactly what the parliamentary shard is (1991–2019). Time overlap runs 2015-11 → 2019-12, about 4.2 of the 6.7 years, ≈22M words likely already present. Net new ≈ 14M words ≈ 36M tokens, covering 2020-01 → 2022-06.

That estimate is soft in both directions:

  • parliamentary has no per-document dates — created is the single literal '1991-01-01, 2019-12-31' on all 324,622 rows. The overlap cannot be measured by filtering, only by comparing content.
  • PPC includes committee sittings and interpellations; ParlaMint-PL is plenary only. So ParlaMint's 2015–2019 portion is plausibly a subset of what already ships, making the real overlap higher than the time-share implies.

Exact dedup will not catch this. build_dynaword.py dedups on sha1 of the whole document. ParlaMint ships one document per session; PPC's segmentation differs, so byte-identical documents are unlikely and the duplicates pass straight through the gate. This needs near-dedup, for which the repo has no committed tooling — the HPLT expansion's near-dedup was run outside src/. Budget for that, or the shard silently duplicates existing data.

Version note

ParlaMint 5.0 does not extend Polish — PL still ends 2022-06, same as the 3.0 deposit already cited in sources.py (handle 11356/1486; 5.0 is 11356/2004). Upgrading buys corrections, not coverage. Neither version closes the gap to sejm_api (2023 onward): mid-2022 through end-2022 stays empty.

Verified

  • CLARIN.SI handle 11356/1486 resolves (HTTP 200). The upstream URL recorded in sources.py is correct and live.
  • License: CC BY 4.0, stated on the repository record.
  • ParlaMint 3.0 overall: 26 comparable corpora, 7,468,674 utterances, 1,147,800,265 words; debates mostly 2015 → mid-2022.
  • The distribution ships a plain-text (.txt) edition alongside TEI/XML and linguistically-annotated .ana.xml. Filenames are per-session, e.g. ParlaMint-PL_2017-07-20-sejm-46-3.txt. Use the .txt edition — no TEI parsing needed.
  • Polish covers both chambers: -sejm- and -senat- session files.

Why it is still worth doing

Fills 2020 → mid-2022, between parliamentary (ends 2019) and sejm_api (2023 onward). Same CC-BY-4.0 family as existing sources, so there is no new license question to answer, and the plain-text edition means no TEI parsing. Cheap. Just do not expect it to move the totals — and do not build it before a source that adds a register the corpus lacks.

Drift found while checking

src/sources.py (the parlamint_pl provenance field) states the corpus was "Fetched directly from the CLARIN.SI plain-text edition (ParlaMint-PL.tgz) by src/fetch_parlamint.py". That script does not exist in src/. The provenance describes a fetch that no committed code performs. Either write the script or correct the field before this ships.


Sejm API — interpelacje and zapytania poselskie

Investigated: 2026-08-27 Verdict: hold — recheck. Not a license problem; api.sejm.gov.pl was unreachable from the investigating network on the day, so the endpoints could not be confirmed. Retry before writing anything off.

What happened

  • api.sejm.gov.pl resolves (194.41.12.231) but every request hangs and then fails — plain curl times out at 45s, a proxied fetch returns ECONNRESET.
  • https://www.sejm.gov.pl/ responds normally (302), and other external hosts were fine the same session, so this is specific to the API host: either an outage, or that host filtering the source network.
  • src/fetch_sejm_api.py (committed, working) uses this same host, so the API is normally reachable. Treat as transient until proven otherwise.

Unverified — what to check on retry

  • Whether sejm/term{N}/interpellations and sejm/term{N}/writtenQuestions exist, and their paging parameters.
  • Whether the ministry's reply body is retrievable as text, or only as a linked PDF. This decides whether the source is worth building: the replies are the substantial half.
  • Document counts per term.

Why it is on the list

Reuses the existing fetch_sejm_api.py legal basis unchanged — official parliamentary materials outside copyright under art. 4(2) pr. aut., reusable under the Open Data Act. Question/answer prose is argumentative register, which the corpus is short on. No new license work needed.


CLARIN-PL DSpace (PELCRA Spokes, and the 1000_novels upstream)

Investigated: 2026-08-27 Verdict: blocked — temporary. The repository is down for reorganization. Nothing to decide until it returns.

Verified

  • https://clarin-pl.eu/dspace/ serves a maintenance notice: "Trwają prace nad repozytorium. Prowadzimy prace serwisowe oraz reorganizację repozytorium DSpace… Repozytorium będzie ponownie dostępne wkrótce."
  • Every item handle under it 404s: 11321/312, 11321/544, 11321/545, 11321/547 — nginx 404, not a DSpace "item not found".
  • The global resolver is broken for this prefix too: hdl.handle.net/11321/* returns HTTP 500.

So no PELCRA record (Spokes, EMO, PARL, EMI) can have its license checked right now. Conversational Polish remains the corpus's biggest register gap, so this is worth re-checking periodically.

Side effect on shipped data

src/sources.py records https://clarin-pl.eu/dspace/handle/11321/312 as the upstream for 1000_novels, which is a released shard. That URL currently does not resolve. Presumed temporary, but the citation in a published datasheet is dead as of this date.

Expected concern when it returns

PELCRA spoken corpora are transcribed private conversation. Expect NC-flavoured or restricted licensing, and expect a personal-data question — these recordings involve identifiable private individuals, not public officials acting officially. Both must be resolved before use.


NIK — Najwyższa Izba Kontroli audit reports

Investigated: 2026-08-27 Verdict: hold — permissive but non-standard license, and enumeration is unsolved. Viable with work; not a quick win.

License evidence — verified

https://www.nik.gov.pl/zasady/prawa-autorskie.html states:

"Korzystanie z materiałów publikowanych w serwisach internetowych Najwyższej Izby Kontroli nie wymaga uzyskania zgody NIK. Nie dotyczy to elementów odrębnie zastrzeżonych (do których prawa autorskie przysługują osobom trzecim), w szczególności oznaczonych materiałów zdjęciowych oraz tekstów publikowanych pierwotnie w innych źródłach."

Attribution to "Najwyższa Izba Kontroli (nik.gov.pl)" is requested, not required.

Assessment: a custom permissive notice, not a standard open license — no CC, no CC0, no SPDX identifier. It carries a third-party carve-out that matters here, because audit reports quote external sources. A separate and probably stronger argument is that audit reports are materiały urzędowe under art. 4 pkt 2 pr. aut., the same basis as dziennik_ustaw and sejm_api. If this source is built, lead with the statutory argument and cite the site notice as corroboration.

Enumeration — unsolved

  • robots.txt allows crawling, but disallows /szukaj/, /p/, /g2/, /cms/, /do_druku/. /g2/ looks like the file store, which likely means report PDFs are off-limits to crawlers.
  • /kontrole/wyniki-kontroli-nik/ returns 200 (~72 kB) but the report list is JS-rendered: zero report links in the server HTML, only pagination scaffolding (fmax,js,strona,1.html).
  • The /prosta/ ("simple") variant is also JS-rendered — 0 report links.
  • No /sitemap.xml (404).

Same shape as ZPE: a backend API almost certainly exists and would need to be found (check the page's JS config for an apiUrl, as worked for ZPE).

Verdict rationale

Register value is real — long-form analytical prose, unlike statute text. But between a bespoke license, a third-party-content carve-out, PDF paths blocked by robots.txt, and unsolved enumeration, this is several days of work. Lower priority than ParlaMint-PL or Sejm interpelacje.


Billion-scale survey — what can actually move the totals

Investigated: 2026-08-27

Context: most candidates land at 30–200M tokens, which is noise against a 9.68B corpus. This entry records the only options measured at 500M–5B, i.e. comparable to european_hplt_v3_pl (2.56B), eurlex (2.38B), parliamentary (1.65B). All numbers below were measured on the day, not taken from cards.

Token conversion throughout: 2.654 tokens/word, measured on the repo's own parliamentary shard (6,000 docs / 9.7M words, cl100k). Use it instead of guessing — Polish runs far above the ~1.3 rule of thumb for English.

candidate measured est. tokens license blocker
SAOS judgments 540,338 docs, mean 3,067 w ~4.4B (floor ~2.8B) art. 4 pkt 2 pr. aut. register: pure legal
FineWeb-2 pol_Latn 152,003,298 docs, 225.9 GB ~83B raw, 4–8B filtered ODC-By dedup vs existing HPLT
PleIAs/Polish-PD 68,176 docs, 0.75B words ~2.0B nominal public domain OCR corruption
HPLT leftovers shards 8_5, 8_6, 31.6 GB ~230M CC0 none — just small

SAOS — biggest clean win, already half-built

https://www.saos.org.pl/api/search/judgments?pageSize=1&pageNumber=0 reports totalResults: 540338. Sampled 100 judgments from api/dump/judgments?pageSize=100&pageNumber=0: mean 3,067 words, median 1,920, p10 816, p90 7,197, court types COMMON and CONSTITUTIONAL_TRIBUNAL.

540,338 × 3,067 = 1.66B words → ~4.4B tokens. Using the median instead, to guard against long-tail skew, still gives ~2.75B. Either way this is larger than any shard currently in the corpus.

src/fetch_saos.py already exists (uncommitted as of this date) and documents the legal basis: judgments are materiały urzędowe outside copyright under art. 4 pkt 2 pr. aut., redistributed by SAOS (CeON/ICM UW + Fundacja ePaństwo) through a bulk-dump API built for exactly this.

Open question before building: judgments are court-anonymised, but that should be verified on sampled text, not assumed — this is the one candidate here where personal data is a live risk rather than a formality.

Cost of shipping it: legal/official goes from 48% to roughly 65% of the corpus. That is the trade, and it should be a deliberate decision rather than a side effect of it being the easy build.

FineWeb-2 Polish — only billion-scale contemporary prose

datasets-server size endpoint, config pol_Latn: 152,003,298 rows / 225.9 GB. At the measured 0.367 tokens/char that is ~83B tokens raw.

License odc-by. Same argument shape as the accepted HPLT basis: the packaging is licensed, the underlying web text is not owned by the publisher. Note that ODC-By is attribution-required, unlike HPLT's CC0 — a different obligation shape, and it has to be stated in the datasheet.

Dedup is not the bottleneck — this was checked, not assumed

The obvious worry is overlap with the existing HPLT shard, since both derive from Common Crawl. It is the smallest of the problems:

  • The existing HPLT shard is 1.6M docs against FineWeb-2's 152M. Even total overlap removes 1% of candidates (12% if working from the HQ subset below).
  • Internal dedup is already done upstream. The schema carries minhash_cluster_size, i.e. FineWeb-2 ran MinHash per language before release.

Cross-dedup against HPLT is still worth doing for hygiene, and the repo still has no committed near-dedup tooling — but it is not what makes this source expensive.

The actual blocker: the HPLT gate cannot be ported

FineWeb-2 pol_Latn columns are:

text, id, dump, url, date, file_path, language,
language_score, language_script, minhash_cluster_size, top_langs

src/clean_hplt_v3.py filters on WDS quality score, register class (ID/OP/HI/IN/NA), and MT-probability. None of those exist in FineWeb-2. Every signal the existing web pipeline depends on is absent, so "filter it like we filtered HPLT" is not an option — it would mean building quality classification over 152M documents from scratch.

epfml/FineWeb2-HQ — the better target

A published quality-filtered derivative, config pol_Latn:

  • 13,384,885 rows, odc-by, 180.4 GB parquet (size dominated by an embeddings column, not text).
  • Adds a quality_score column, retained per document, so the selection threshold stays a tunable knob instead of a baked-in decision — and the classifier is someone else's published work, which is easier to cite than a home-grown one.
  • Sampled 880 docs across 22 evenly-spread offsets: mean 2,663 chars/doc → ~13.1B tokens for the whole HQ subset. Larger than the entire current corpus.

quality_score → token yield

Distribution from the statistics endpoint (computed on a partial 407,184-row sample, not all 13.4M): min 0.013, max 0.9999, mean 0.145, median 0.0496 — heavily right-skewed, so most of HQ still scores low.

Doc fractions from that histogram, mean lengths from the 880-doc sample:

quality_score ≥ % docs docs mean chars est. tokens
0.00 (all) 100% 13,384,885 2,663 13.1B
0.11 31.0% 4,149,000 2,375 3.6B
0.21 20.0% 2,677,000 2,074 2.0B
0.31 14.6% 1,954,000 1,929 1.4B
0.41 11.1% 1,486,000 1,912 1.0B
0.51 8.5% 1,138,000 1,798 0.75B
0.70 4.8% 642,000 1,750 0.41B
0.90 1.8% 241,000 914 0.08B

A second pass computing fractions directly from the 880-doc sample agreed with these within ~15%. Treat them as ±20%, good enough to pick a threshold.

Watch out: quality_score anti-correlates with document length. Mean length falls from 2,663 chars at no threshold to 914 at ≥0.90. The classifier is not rewarding long-form prose, so raising the threshold costs more tokens than the doc-count alone implies, and it may actively select against the extended prose this corpus is short on. Sample the text at whatever threshold is chosen before committing to it.

Recommended operating point

Threshold ≈ 0.20 → ~2.7M docs, ~2.0–2.3B tokens. Comparable to the largest existing shards (european_hplt_v3_pl 2.56B, eurlex 2.38B) and it improves the balance rather than wrecking it: web goes 26% → ~41%, legal drops 48% → ~39%.

Taking all 13.1B instead would put the corpus at ~22.7B with web at ~69% — trading "two-thirds legalese" for "two-thirds crawl". Same failure, different axis.

Work order if this is built

  1. Pick HQ vs full, and a quality_score threshold (see above).
  2. Build the PII scrub. sources.py already claims one for the HPLT shard that has no implementing code in src/; shipping a second web source with the same gap is indefensible.
  3. Near-dedup against the existing HPLT shard — needed, but ~1–12% effect.
  4. Compute. Tokenizing billions of tokens is the genuinely expensive step.

PleIAs/Polish-PD — good on paper, rough in practice

68,176 rows. Sampled word_count at four offsets (n=200): mean 10,971 words, median 8,468 → 0.75B words → **2.0B tokens**. Columns are identifier, file, title, creator, language, word_count, character_count, complete_text. Public domain, pre-1884 monographs and periodicals, largely sourced from Polish digital libraries (jbc.bj.uj.edu.pl in the sample).

Register-wise this is the most attractive of the three — books and periodicals, against a corpus that is only 1.9% literature.

But the OCR is bad. First sampled record (an 1817 newspaper) opens:

U
RUSKI
czwaRTEŁ SONAER
5 PC Nę R
WIADOMOŚC

with pre-1884 orthography throughout (Nayiaśnieyszy, roskazać, klassy).

The existing OCR gate will not catch this. build_dynaword.py applies MIN_ALPHA_RATIO = 0.70 when is_ocr: True, which tests the ratio of letters to symbols. Garbled words made of ordinary letters pass it cleanly. Filtering this source needs a dictionary- or perplexity-based check, which does not exist here. Treat the 2.0B as nominal; real usable yield is materially lower.

HPLT is exhausted — correction to an earlier assumption

https://data.hplt-project.org/three/sorted/pol_Latn/ lists exactly 19 shards: 10_1, 9_1–9_4, 8_1–8_6, 7_1–7_4, 6_1–6_2, 5_1–5_2. There are no WDS bins below 5 for Polish.

sources.py records 17 of those as ingested. The only unused shards are 8_5 (24.24 GB) and 8_6 (7.37 GB) — roughly 230M tokens at the post-filter rate implied by the existing shard.

So "add more HPLT bins" is not a path to billions. It is one small top-up, and then the source is finished.

Conclusion

Every clean billion-scale Polish source is legal, official, or archaic — which follows directly from what falls outside copyright. The only billion-scale contemporary general prose is web crawl, and that is a re-derivation of Common Crawl the corpus already draws on.

If the goal is raw scale: SAOS. If the goal is a corpus that is not two-thirds legalese, there is no billion-scale option, and the honest plan is a number of 50–200M-token sources across different registers.