1000_novels: drop texts already in wolne_lektury or eltec_pol (887 → 221 docs) (v2#45)

#70
by ppuzio - opened
Fabryka AI org
•
edited 2 days ago

What and why

Drops the 666 public-domain 1000_novels texts that wolne_lektury or eltec_pol already carries. This is the decision in slayerlabs/polish-dynaword-v2#45: drop the 1000_novels copy and keep WL and ELTeC whole. The method is the one measured for #45. The input is main at 3bab9f9 (Hub PR 65, 887 rows); the references are main's Parquets after Hub PR 67 (see Merged after Hub PR 67 below). The build still starts from the pinned v0.2.5 Parquet and runs the rights screen first, so one script produces the release.

before (main, 3bab9f9) after change
documents 887 221 −666
chars 130,201,301 26,625,861 −103,575,440
tokens 51,981,548 10,759,728 −41,221,820

The 221 kept rows are byte-identical to main's rows and in the same order. wolne_lektury and eltec_pol are not touched.

Rule

The rule is a new dedup step in src/clean_1000_novels.py, run after the rights screen and tested in src/test_1000_novels_contract.py. The scoring code is in src/shingle_containment.py with tests in src/test_shingle_containment.py. This is the same module, byte for byte, as in Hub PR 67 (#72), where src/clean_wolne_lektury.py also imports it. Whichever PR merges second will show the two files as unchanged.

For each screened text, and for each reference source separately:

  • cover = |S(text) ∩ ⋃ S(doc)| / |S(text)|, with the union taken over all of that source's documents.
  • S() is the set of unique 5-word shingles over NFKC-casefolded \w+ tokens, which is near_dedup's tokenisation. Words are hashed with blake2b, so covers are reproducible across processes.
  • A trailing Wolne Lektury footer is cut from the text before scoring. The released text is unchanged.
  • The union is needed because WL splits novels into tomes. 7 texts are duplicates only across several WL documents, for example Popioły (0953): it is spread over 3 WL tomes, none above 0.33, and their union reaches 0.9602. The other 6 are 0172, 0360, 0364, 0382, 0388 and 0524. (Before PR 67 there were 9, with 0703 Chłopi and 0907; PR 67 dropped their WL tomes and both are now ELTeC drops.)
  • A text is dropped if its cover is ≥ 0.5 against wolne_lektury or against eltec_pol.

Pins. All inputs are pinned by SHA-256, and the script fails closed if any of them differs:

  • wolne_lektury f308d492… (main's after Hub PR 67; was 5833c25d… before the merge commit) and eltec_pol ba400617… (unchanged since v0.2.1);
  • the v0.2.5 1000_novels Parquet 27be09e5…;
  • the screen 7fefc75f….

Outputs. Writes go through .tmp files and os.replace. data/1000_novels/1000_novels.dedup.tsv lists every one of the 887 screened texts with:

  • its action;
  • its cover against each source;
  • each reference document holding ≥ 0.05 of its shingles, with that share;
  • its author and title.
result texts
dropped 666
… cover ≥ 0.5 against wolne_lektury 629 (664 before PR 67)
… cover ≥ 0.5 against eltec_pol 37
… against both 0 (35 before PR 67)
… eltec_pol only 37 (2 before PR 67: Dygasiński's Wilk, psy i ludzie (0197, 0.9892) and As (0199, 0.9504))
kept 221

Threshold and gap

Cover distribution over the 887 screened texts (wolne_lektury after PR 67):

cover vs wolne_lektury vs eltec_pol
[0, 0.01) 225 843
[0.01, 0.05) 31 7
[0.05, 0.1) 2 0
[0.1, 0.5) 0 0
[0.5, 0.6) 2 0
[0.6, 0.7) 3 0
[0.7, 0.8) 7 1
[0.8, 0.9) 27 4
[0.9, 0.95) 10 0
[0.95, 0.99) 52 2
[0.99, 1] 528 30
  • Against wolne_lektury, no text covers between 0.0727 and 0.5178 (0.0728 and 0.5181 before PR 67).
  • Against eltec_pol, no text covers between 0.0462 and 0.7771.
  • 0.5 sits inside both gaps. The highest cover among kept texts is 0.0727 against WL and 0.0116 against ELTeC.

Hand-check

Every text with a cover between 0.3 and 0.7 was read, plus 0703 and 0493. All are dropped.

id text cover verdict
0255 Grabiński, Spojrzenie WL 0.6721 Drop. The same story. Per-tenth match is 0.62–0.74 throughout. The longest unmatched run is 20 shingles, caused by soft-hyphen word breaks ("opuści ła").
0388 Laclos, Niebezpieczne związki WL 0.6975 (tomes 0.41 + 0.29) Drop. The whole 1912 Boy translation in old spelling, which lowers the cover throughout (0.51–0.88 per tenth). WL holds it in 2 tomes. The longest unmatched run is the collected footnotes at the end (420 shingles).
0493 Orkan, Listy ze wsi WL 0.5178 (Płanety) Drop, with a loss. Sections I and II match at 0.76–0.90 per tenth. The last section (IV, about 1,100 words) is not in WL.
0509 Orzeszkowa, Bóg wie kto WL 0.6291 Drop. A 1909 serial instalment: 2,342 of WL's 6,677 words, in old spelling. The longest unmatched run is 28 shingles.
0891 Verne, Przygody trzech Rossyan… WL 0.5383 Drop. The same Anczyc translation. Old spelling ("é") lowers the cover evenly (0.42–0.60 per tenth). The longest unmatched run is 49 shingles.
0703 Reymont, Chłopi ELTeC 0.8259; WL 0.8272 over 4 tomes before PR 67, 0.0030 after Drop. An abridged edition of about 43,000 words in old spelling; ELTeC's text has about 306,000. The longest unmatched run is 25 shingles.

Recommendation on 0493. The #45 comment notes that the text is only about 60% in WL and that the rule drops it. This PR follows that. The alternative is to keep the row, which keeps section IV but also keeps about 2,000 duplicated words.

10 clear drops, sampled with seed 45, were read:

  • Ids: 0393, 0625, 0749, 0373, 0106, 0440, 0508, 0031, 0095, 0745. All are WL duplicates.
  • Each is the same text as its WL match: 98.3–100% of its shingle positions match.
  • The longest unmatched run is 85 shingles, in the footnotes of 0508.

Checked for false negatives among the kept texts:

  • None carries a Wolne Lektury footer.

  • 4 share author and title with a WL document, but each is a different text:

    id text why it is different cover
    0065 Balzac, Kobieta trzydziestoletnia Marrene's translation; WL has Boy's 0.0388
    0239 Grabiński, Na wzgórzu róż the title story is not in WL 0.0043
    0359 Kraszewski, Dziad i baba a prose tale; WL has the poem 0.0079
    0690 Przybyszewski, Nad morzem WL has a 354-word piece 0.0303

Merged after Hub PR 67 (#72)

PR 67 merged first and dropped 63 WL documents that duplicate eltec_pol. The merge commit b6e9630 re-pinned REFERENCES["wolne_lektury"] to main's new Parquet (f308d492…, was 5833c25d…) and rebuilt 1000_novels from the v0.2.5 Parquet with the pinned screen:

  • The 666 drops are the same set, because a novel PR 67 removes from WL is still caught through eltec_pol. The Parquet and the attribution sidecar are byte-identical to 1673f88.
  • The split changes from WL 664, ELTeC 37, both 35 to WL 629, ELTeC 37, both 0.
  • 216 WL cover values in the TSV change. The WL gap moves to 0.0727–0.5178. The hand-checked texts between 0.3 and 0.7 and the 10 sampled drops are still WL drops.
  • stats.json, dedup.tsv, the datasheet, the script comments and the findings entry were updated to match. The findings conflict was resolved by keeping both entries, wolne_lektury first.

The figures in this description are the merged state; pre-merge values are noted where they differ.

Provenance and licence

  • No new data is fetched. The step only removes rows.
  • Licence labels are unchanged: all 221 rows are public-domain from the rights screen (PR 65).
  • The dropped texts are not a rights finding. They stay available through WL (CC BY-SA 4.0 / Free Art License edition) and ELTeC (CC BY 4.0).
  • 1000_novels.license-evidence.json: release_scope gains dropped_cross_source_duplicate: 666 and kept becomes 221; a cross_source_dedup note is added.
  • 1000_novels.stats.json gains:
    • drop_cross_dup: 666;
    • cross_dup (the 629 / 37 / 0 split; 664 / 37 / 35 before PR 67);
    • both reference SHA-256s.
  • Datasheet 1000_novels.md (hand-written): the statistics, licence and author counts and the attribution title counts (213 / 1 / 7) are updated, and the filters section has a new line.
  • In src/sources.py, one provenance sentence is added; release is unchanged.
  • A findings entry is appended at the end of artifacts/source_findings.md.
  • make_docs.py was run. It produced drift in README.md, CHANGELOG.md and wiktionary_examples.md that is unrelated to this source, so that drift was reverted.
  • Reproducibility: rebuilding from the v0.2.5 Parquet with the pinned screen (about 100 s) gives byte-identical Parquet, attribution, TSV and stats.

Tests

  • Before, at 3bab9f9: 23 failed, 259 passed, 7 errors.
  • After, at 1673f88: 23 failed, 268 passed, 7 errors.
    • The same 30 test ids fail before and after. None is a 1000_novels, wolne_lektury or eltec_pol test; most read other sources' LFS files, which this worktree has only as pointers.
    • The 9 extra passes are the 4 test_shingle_containment.py tests and 5 new test_1000_novels_contract.py tests:
      • no kept text at or above 0.5 against either source. This is checked on the precomputed 1000_novels.dedup.tsv, because scoring the references takes minutes. The test also checks drop/keep against the covers, the keep ids against the Parquet ids in order, the matches, the counts, the reference pins in stats, and chars and tokens.
      • cover on each side of the threshold: exactly 104/208 = 0.5 is a drop; 103/207 and one shingle short are keeps.
      • footer cut, union over tomes, and the 0.05 match listing.
      • reference pins fail closed.
      • datasheet counts match stats.
  • Merge commit b6e9630: the 1000_novels, wolne_lektury and shingle tests pass (17). Full suite: 23 failed, 272 passed, 7 errors, against 24 failed, 266 passed, 7 errors on main at 563eea8. No new failure; the extra main failure is test_1000_novels_contract.py::test_schema_counts_and_attribution, which reads a Parquet that the main worktree had only as an LFS pointer.

Sample

python3 src/render_sample.py data/1000_novels/1000_novels.parquet -n 3

id: 1000_novels_0957
source: 1000_novels
added: 2026-06-26
created: 1785-01-01, 2013-12-31
token_count: 10656
license: public-domain
author: Stefan Żeromski

Puszcza jodłowa
Stefan Żeromski	

Panu Aleksandrowi Janowskiemu wyraz braterskiej czci

W uszach moich trwa szum twój, lesie dzieciństwa i młodości — choć tyle już lat nie dano mi go słyszeć na jawie! Przebiegam w marzeniu wyniosłe góry — Łysicę, Łysiec, Strawczaną, Bukową, Klonową, Stróżnę — góry moje domowe — Radostową i Kamień — oraz wszystkie dalekie siostrzyce. Nie ja to już, człowiek dzisiejszy, wciągam zdrowymi płucami tameczne powietrze, kryształ niewidzialny, niezmierzone, nieskazitelne, przeczyste dobro — zimne, nie skalane oddechem, zgnilizną, brudem, pyłem — lecz ktoś inny, kogo już dawno nie ma, młodzieniec, który niegdyś w mym jestestwie przebywał. Nieraz mi się wydaje, że go wcale nie było, że to po prostu jedna ze zmyślonych figur, które wynajdywać w nicości, tworzyć, […]
id: 1000_novels_0594
source: 1000_novels
added: 2026-06-26
created: 1785-01-01, 2013-12-31
token_count: 15976
license: public-domain
author: Helena Janina Pajzderska

DZWONEK.


 Nad brzegiem chodnika ciągnącego się wzdłuż pięknéj, trzypiętrowéj kamienicy, stał mężczyzna w grubym kożuchu i barankowéj czapce, nasuniętéj na uszy i żelaznym drągiem rozrąbywał brudny lód, ktorym silny mróz ubiegłéj nocy ściął wodę w warszawskich rynsztokach.
 Czasem przy mocniejszem uderzeniu, kawałek zbrylonego błota prysnął mu w twarz zaczerwienioną od zimna; wtedy obcierał ją czerwieńszą jeszcze, posiekaną ręką i rąbał daléj.
 Po niejakim czasie wyprostował swą barczystą, krępą postać, oparł obie dłonie na drągu i odsapnąwszy energicznie, zapatrzył się na poranny ruch uliczny. W tém jego zapatrzeniu się nie było ciekawości, rzeczy, na które patrzył, nie miały dlań nic nowego, widywał je codzień o téj saméj porze; była to raczéj jakaś smutna bezmyślność człowieka, który […]
id: 1000_novels_0119
source: 1000_novels
added: 2026-06-26
created: 1785-01-01, 2013-12-31
token_count: 23833
license: public-domain
author: Joseph Conrad (tłum. Zagórska)

Jutro (Conrad)

<<< Dane tekstu 
Autor	Joseph Conrad
Tytuł	Jutro
Pochodzenie	Falk: wspomnienie, Amy Foster, Jutro
Data wydania	1932
Wydawnictwo	Dom Książki Polskiej Spółka Akcyjna
Drukarz	Drukarnia Narodowa w Krakowie
Miejsce wyd.	Warszawa
Tłumacz	Aniela Zagórska
Tytuł orygin.	To-morrow


 To co wiedziano o kapitanie Hagberdzie w małym porcie morskim Colebrook niekoniecznie przemawiało na jego korzyść. Nie pochodził z Colebrook. Osiedlił się tam wśród okoliczności bynajmniej nie tajemniczych — swego czasu opowiadał o nich bardzo często — lecz niezmiernie dziwacznych i bezsensownych. Miał widać trochę pieniędzy, gdyż kupił kawał gruntu i kazał sklecić bardzo tanim kosztem parę brzydkich, żółtych domków z cegły. Jeden z nich zajmował sam a drugi wynajął Jozuemu Carvilowi — ślepemu […]

🤖 Generated with Claude Code

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

Sign up or log in to comment