wikinews: drop lone file-link option lines (v2#116), relabel (v2#110)

#132
by ppuzio - opened
Commit history is no longer available for this pull request.
Fabryka AI org
•
edited 9 days ago

Removes the main leftover of the wikinews cleanup in PR 130: a line holding only a file-link option word (v2#116). This is the first of three PRs, one per source. It carries the rule, and the wikivoyage and wikibooks PRs follow.

Rule: drop_residue also drops a line that is exactly mały, right, left, center or centre. Trailing spaces or tabs are allowed. This is what strip_code leaves of [[Plik:X.jpg|mały]], because it keeps the last parameter as the caption. An indented line stays, since the indent comes from a list bullet.

Audit: each such line in the wikinews, wikivoyage and wikibooks releases was checked against the wikitext of the shipped revision, fetched by revid from the APIs. All 568 lines come from a file link with that text: wikinews 388, wikivoyage 24, and wikibooks 156, of which 109 are center. The one exception is an indented mały in a word list (wikibooks_4816), which the indent rule keeps. Other option words alone on a line (prawo, border, frame, ramka, links, all in wikibooks) are prose or table cells, so they stay.

Effect on wikinews: 371 rows lose 388 lines, 2,157 characters and 1,039 tokens. In 365 rows the dropped line was the first line. The words were mały 258, right 94, left 35 and centre 1. Three rows had no other residue, so the cleanup now changes 24,207 rows. No page fell under 200 characters.

label documents tokens share
CC-BY-2.5 19,823 9,347,108 85.2%
CC-BY-2.5 AND CC-BY-4.0 113 81,123 0.7%
CC-BY-4.0 3,637 1,541,154 14.0%

Totals are 23,573 documents and 10,969,385 tokens (was 10,970,210). The label counts are unchanged. Only two rows in the labels file differ: wikinews_20726 and wikinews_20931 move from no_text_added to identical_text, and both stay 2.5. Their pre-cutoff text had a lone mały that the shipped text lacks, and the rule now drops it there too.

Link targets (second commit): PR 130's rule let a link= value (also lang=, page=, class=) run to the end of the line when no pipe followed. A link target at the end of a line then swallowed the prose after it, because strip_code joins that prose to the target once it drops the link's ]]. Three released rows lost prose this way:

  • wikinews_23748 lost its lead paragraph (244 characters).
  • wikinews_44491 and wikinews_45543 lost an e-mail domain, a sentence and two URLs (190 and 212 characters).

The rule changes in three ways:

  • A target at the end of a line is now treated as a page title of up to 8 words; anything longer stays as prose. The longest released target has 6 words (wikivoyage_3585); the prose lines have 14 or more.
  • A value can no longer start with a space.
  • An empty link= before text is removed, which clears leftovers from three election tables (wikinews_74650, 77187, 79552).

Overall: 6 rows, +616 characters, +214 tokens; the labels are unchanged. In wikinews_23748 the target itself stays (link=w:Polska (dziennik) opublikowała…), since the text gives no sign of where the target ends; the card lists it under what drop_residue leaves. The new rule changes no row in wikivoyage or wikibooks.

Reproduction: the rerun started from the data before PR 130 (commit 916716d). It ran retext, then wiki_history.py scan, fetch and compare on the same stub dump (sha1 4ad674a2…), then relabel and datasheet. With the previous rule, the same chain reproduces main byte for byte, for all six files and the labels.

Tests: the wikinews, wikimedia and wiki_history tests pass. Compared with the baseline there are three new failures. Two are test_wikivoyage_contract and test_wikibooks_contract, which check drop_residue(text) == text on the released text. They fail until those sources are cleaned in the next two PRs, so merge those soon after this one. The third, test_every_row_is_labelled_by_contribution, is the PR 128 rename of a test that already failed on the LFS-pointer wikipedia shard in the worktree. The wikivoyage and wikibooks cards come out byte-identical under the new code. Details are in artifacts/source_findings.md.

🤖 Generated with Claude Code

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

Sign up or log in to comment