parliamentary: repair cp1250 misdecoding, drop exact copies (v2#54, 1A/2A)

#111
by ppuzio - opened

Follow-up to #108 (v2#54, decisions 1A and 2A). Parliamentary only.

Encoding. Some records in the PPC dump are Windows-1250 bytes read as ISO-8859-2, so ś/ź appear as C1 controls (\x9c, \x9f). Lines with C1 controls and no Polish letters are re-decoded (.encode("iso-8859-2").decode("cp1250")); stray controls in otherwise correct text are mapped (\x9c→ś, \x9a→š, \x96→–, …). \x88 (č, "Poto\x88nik") and \x98 (stray, "Gr\x98ünbaum") are unassigned in cp1250, so they are handled before the line check — the first build failed on 0x98 instead of guessing. 1,170 records re-decoded whole (1,162 Sejm interpellation records of 2007-2011), 26 repaired by line, no U+0080-U+009F left. Not detected: 7 lines in 5 records listed in the card (an š there is as likely "Babiš" as a misread ś).

200507-sjm-ipxxx-03491-01
  before: '…poz. 59, z pó\x9fn. zm.) w zakresie prawa mężczyzny okre\x9clonego w art. 80…'
  after:  '…poz. 59, z późn. zm.) w zakresie prawa mężczyzny określonego w art. 80…'
193035-sjm-ppxxx-00001-01
  before: '110. Gr\x98ünbaum Izaak,'
  after:  '110. Grünbaum Izaak,'

Exact copies. Records whose text is identical after the encoding repair and PII pass are kept once (first in MANIFEST, then document order). 18,612 records dropped in 2,143 groups; all but 7 are interpellation records — one interpellation sent to several ministers, or one reply filed under each question (largest group: 538). 18,543 of the dropped copies have the same author as the kept one. Every dropped id and the id kept in its place are in the new parliamentary.decisions.jsonl (LFS). No near-dup or cross-source dedup.

before (#108) after
records 348,475 329,863
cl100k_base tokens 1,606,998,487 1,504,127,614
characters 4,370,190,797 4,098,061,466
records with author 298,185 279,628
redactions 12,733 11,626

Parquet SHA-256 07903953faa3bb88bd5083500cc77e8d49aa505037f7420bab49f09b7bb4115b (was 5f21252e…).

Also in the card: the dump runs co-authors together in one <author> ("Tomasz GarbowskiTadeusz TomaszewskiBogusław Wontor"); author keeps the string as given.

IPI PAN (Dariusz Czerski, e-mail): TEI marks non-members role="guest", so the speaker allowlist stays; the format and ids are stable. Edit after merge: whether the Biblioteka Sejmowa documents came with conditions was answered by Maciej Ogrodniczuk (e-mail, 2026-10-08): handed over without further restrictions (Hub PR 112).

Depends on this: sejm_api_2011_2022 pins this parquet by SHA-256 (src/clean_sejm_api_2011_2022.py REFERENCES). After merge its rebuild fails on the pin until a re-pin PR lands; I'll open that next.

Tests: GIT_LFS_SKIP_SMUDGE=1 pytest src — 98 failed / 852 passed / 18 errors vs 101 failed / 18 errors on main; no new failures. test_parliamentary_contract.py: 37 passed (new: encoding repair, non-cp1250 controls, dedup and sidecar, card figures).

render_sample.py -n 2 --max-chars 500:

id: parliamentary_196972-sjm-ppxxx-00014-01
source: parliamentary
added: 2026-06-15
created: 1971-05-20
token_count: 83353
license: public-domain (official documents)
author: 

(Początek posiedzenia o godz. 11)
(Przewodniczą na posiedzeniu Marszałek Sejmu Dyzma Gałaj oraz wicemarszałkowie Andrzej Werblan i Andrzej Benesz)
Otwieram posiedzenie.
Powołuję na sekretarzy posłów Wacława Jagodzińskiego i Stanisława Nowińskiego.
Protokół i listę mówców prowadzi poseł Wacław Jagodziński.
Proszę Posłów Sekretarzy o zajęcie miejsc przy stole prezydialnym.
Protokół 13 posiedzenia Sejmu uważam za przyjęty, gdyż nie wniesiono do niego żadnych poprawek.
Prezydium Sejmu […]
id: parliamentary_202327-snt-bfpxx-00053-01
source: parliamentary
added: 2026-06-15
created: 2025-04-22
token_count: 14783
license: public-domain (official documents)
author: 

(Początek posiedzenia o godzinie 18 minut 04)
(Posiedzeniu przewodniczy przewodniczący Komisji Budżetu i Finansów Publicznych Kazimierz Kleina)
Otwieram wspólne posiedzenie Komisji Zdrowia oraz Komisji Budżetu i Finansów Publicznych.
Przedmiotem naszego posiedzenia jest rozpatrzenie ustawy o zmianie ustawy o świadczeniach opieki zdrowotnej finansowanych ze środków publicznych oraz niektórych innych ustaw.
Czy są uwagi do porządku posiedzenia? Pytam senatorów, członków obu komisji. Nie widzę […]

🤖 Generated with Claude Code

ppuzio changed pull request status to open
ppuzio changed pull request status to merged
ppuzio deleted the refs/pr/111 ref

Sign up or log in to comment