wikivoyage: withhold the Wikitravel layer, add record links and citations (v2#110)

#141
by ppuzio - opened
Commit history is no longer available for this pull request.

Withholds the Wikitravel layer of wikivoyage and adds the per-record links and source fields (v2#110, 1A, 3B). This PR carries the code for all seven wiki sources; the wikibooks (#142), wiktionary_examples (#143), plwiki_talk (#144) and plwiki_user_talk (#145) data are in their own PRs, wikinews and wikipedia later.

Withheld: the 6,328 pages whose shipped revision carries {{Atrybucja}} (6,326) or {{Import}} (2, a redirect to it). The template gives the Wikitravel text as CC BY-SA 1.0, which does not let adaptations move to a later version, and whether Wikitravel's own move to 3.0 covers the imported text is not checked page by page. build.json lists them by template (page id, title).

Labels per record (7,312 documents, 14,084,102 tokens; was 13,640 / 16,958,893)

label documents tokens share
CC-BY-SA-3.0 5,399 4,228,272 30.0%
CC-BY-SA-3.0 AND CC-BY-SA-4.0 1,179 8,897,895 63.2%
CC-BY-SA-4.0 734 957,935 6.8%

Sidecar: each line gains permalink, history_url, license_urls and conversion, plus citations (54 rows have any) and source_notes (empty: the pages with a source template are the withheld ones). The card gains the quotation paragraph (Art. 29) and its Not-checked entries are reworded to match. The created range now starts 2013-09-07 (sources.py).

Code:

  • wiki_history.py: LICENSE_URLS, CONVERSION and record_links, which give the four link fields; apply_labels takes the source.
  • rights.py: WITHHELD_TEMPLATES (wikivoyage Atrybucja/Import, wikibooks GFDL-tekst), IMPORT_TEMPLATES (the Wikinews partners, wikibooks Cc-by-3.0-tekst) and 4 wikibooks DROPPED_PAGES (GNU FDL text added after 2008-11-01).
  • fetch_wikimedia.py: withheld_template withholds a page by template on its shipped revision; provenance adds citations and source_notes (page_sources) from the build's dump; with_imports adds an imported text's licence to the label; the datasheet writes the links, quotation and source paragraphs and the withheld line.
  • clean_plwiki_talk.py: a provenance step reads the talk citations from the pages-meta-current dump, checks each row's revision time and wikitext length, redacts them with redact_pii and counts the redactions in qa.json; build_plwiki_talk_pl.py keeps the revision id.
  • fetch_wiktionary_examples.py: title, URL and the link fields per row, and a check that each row's credit matches its page title.

Tests: the wikivoyage and wiki_history tests pass. Until their data PRs are merged, these fail: the 3 data tests in test_wikibooks_contract, test_every_row_label_follows_its_contribution_basis and test_citations_are_redacted_and_counted for both talk sources, test_labels_by_contribution_date (wiktionary_examples), test_every_row_is_labelled_by_contribution (wikipedia) and test_wikinews_contract. With the sibling data in place they pass, except test_wikinews_contract, which waits for the wikinews data PR (its card and sidecar are rebuilt there); the full suite shows no new failures against the baseline (LFS-pointer shards in the worktree). README, CHANGELOG and totals are left to v2#80.

🤖 Generated with Claude Code

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

Sign up or log in to comment