wikinews: withhold a podcast blurb, label imported text, add record links and citations (v2#110)
#146
by ppuzio - opened
- data/wikinews/wikinews.attribution.jsonl +2 -2
- data/wikinews/wikinews.build.json +20 -14
- data/wikinews/wikinews.license-evidence.json +33 -7
- data/wikinews/wikinews.md +64 -19
- data/wikinews/wikinews.parquet +2 -2
- data/wikinews/wikinews.stats.json +22 -9
- src/fetch_wikimedia.py +5 -3
- src/rights.py +4 -1
- src/sources.py +1 -1
- src/test_wikinews_contract.py +27 -9
data/wikinews/wikinews.attribution.jsonl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6242095f7ef4d0951126162f0069f4edd6f9046c84313bd3cd113d3d53b95cbf
|
| 3 |
+
size 25976930
|
data/wikinews/wikinews.build.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"attribution_rows":
|
| 3 |
-
"attribution_sha256": "
|
| 4 |
"cutoff": "2024-12-16T00:00:00+00:00",
|
| 5 |
"discovered_at": "2026-10-06T00:00:15.478622+00:00",
|
| 6 |
"dump_base": "https://dumps.wikimedia.org/plwikinews/20260601",
|
|
@@ -23,7 +23,7 @@
|
|
| 23 |
"identical_text": 1972,
|
| 24 |
"no_text_added": 78,
|
| 25 |
"same_revision_text": 602,
|
| 26 |
-
"shipped_before_cutoff":
|
| 27 |
},
|
| 28 |
"created_on_cutoff_day": 1,
|
| 29 |
"stub": {
|
|
@@ -36,31 +36,37 @@
|
|
| 36 |
},
|
| 37 |
"prepare": {
|
| 38 |
"counts": {
|
| 39 |
-
"CC-BY-2.5":
|
| 40 |
"CC-BY-4.0": 6404,
|
| 41 |
-
"dropped_page":
|
| 42 |
"exact_duplicate": 1,
|
| 43 |
"ns0": 47845,
|
| 44 |
"ns0_redirect": 23366,
|
| 45 |
"ns0_short": 899,
|
| 46 |
"pages": 65253,
|
| 47 |
-
"written":
|
| 48 |
},
|
| 49 |
-
"dropped_pages": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
"exact_duplicate_pageids": [
|
| 51 |
"24619"
|
| 52 |
]
|
| 53 |
},
|
| 54 |
"residue_cleanup": {
|
| 55 |
"after": {
|
| 56 |
-
"chars":
|
| 57 |
-
"docs":
|
| 58 |
-
"tokens":
|
| 59 |
},
|
| 60 |
"before": {
|
| 61 |
-
"chars":
|
| 62 |
-
"docs":
|
| 63 |
-
"tokens":
|
| 64 |
},
|
| 65 |
"dropped_duplicate": [
|
| 66 |
{
|
|
@@ -4132,7 +4138,7 @@
|
|
| 4132 |
}
|
| 4133 |
],
|
| 4134 |
"issue": "slayerlabs/polish-dynaword-v2#116",
|
| 4135 |
-
"rows_changed":
|
| 4136 |
"step": "fetch_wikimedia.drop_residue"
|
| 4137 |
},
|
| 4138 |
"rightsinfo": {
|
|
|
|
| 1 |
{
|
| 2 |
+
"attribution_rows": 23572,
|
| 3 |
+
"attribution_sha256": "6242095f7ef4d0951126162f0069f4edd6f9046c84313bd3cd113d3d53b95cbf",
|
| 4 |
"cutoff": "2024-12-16T00:00:00+00:00",
|
| 5 |
"discovered_at": "2026-10-06T00:00:15.478622+00:00",
|
| 6 |
"dump_base": "https://dumps.wikimedia.org/plwikinews/20260601",
|
|
|
|
| 23 |
"identical_text": 1972,
|
| 24 |
"no_text_added": 78,
|
| 25 |
"same_revision_text": 602,
|
| 26 |
+
"shipped_before_cutoff": 17170
|
| 27 |
},
|
| 28 |
"created_on_cutoff_day": 1,
|
| 29 |
"stub": {
|
|
|
|
| 36 |
},
|
| 37 |
"prepare": {
|
| 38 |
"counts": {
|
| 39 |
+
"CC-BY-2.5": 17174,
|
| 40 |
"CC-BY-4.0": 6404,
|
| 41 |
+
"dropped_page": 1,
|
| 42 |
"exact_duplicate": 1,
|
| 43 |
"ns0": 47845,
|
| 44 |
"ns0_redirect": 23366,
|
| 45 |
"ns0_short": 899,
|
| 46 |
"pages": 65253,
|
| 47 |
+
"written": 23578
|
| 48 |
},
|
| 49 |
+
"dropped_pages": [
|
| 50 |
+
{
|
| 51 |
+
"pageid": "55256",
|
| 52 |
+
"reason": "2021-09-12: „Ostatni telefon z WTC” – 4. odcinek Klubu Ludzi Ciekawych Wszystkiego: carries {{Zaimportowany}} pointing to the episode's page on podkasty.info, and its text repeats the episode's blurb (\"porozmawiamy\", \"Oto nasi goście\"); neither the template nor the site states a licence",
|
| 53 |
+
"title": "2021-09-12: „Ostatni telefon z WTC” – 4. odcinek Klubu Ludzi Ciekawych Wszystkiego"
|
| 54 |
+
}
|
| 55 |
+
],
|
| 56 |
"exact_duplicate_pageids": [
|
| 57 |
"24619"
|
| 58 |
]
|
| 59 |
},
|
| 60 |
"residue_cleanup": {
|
| 61 |
"after": {
|
| 62 |
+
"chars": 29396894,
|
| 63 |
+
"docs": 23572,
|
| 64 |
+
"tokens": 10968504
|
| 65 |
},
|
| 66 |
"before": {
|
| 67 |
+
"chars": 32523432,
|
| 68 |
+
"docs": 24385,
|
| 69 |
+
"tokens": 12140901
|
| 70 |
},
|
| 71 |
"dropped_duplicate": [
|
| 72 |
{
|
|
|
|
| 4138 |
}
|
| 4139 |
],
|
| 4140 |
"issue": "slayerlabs/polish-dynaword-v2#116",
|
| 4141 |
+
"rows_changed": 24206,
|
| 4142 |
"step": "fetch_wikimedia.drop_residue"
|
| 4143 |
},
|
| 4144 |
"rightsinfo": {
|
data/wikinews/wikinews.license-evidence.json
CHANGED
|
@@ -31,16 +31,29 @@
|
|
| 31 |
"url": "https://creativecommons.org/licenses/by/2.5/legalcode"
|
| 32 |
}
|
| 33 |
],
|
| 34 |
-
"license": "CC-BY-2.5, CC-BY-4.0 or both per record, by contribution date",
|
| 35 |
"release_scope": {
|
| 36 |
"created_range": [
|
| 37 |
"2011-12-24",
|
| 38 |
"2026-05-25"
|
| 39 |
],
|
| 40 |
"labels": {
|
| 41 |
-
"CC-BY-2.5":
|
| 42 |
-
"CC-BY-2.5 AND CC-BY-
|
| 43 |
-
"CC-BY-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
},
|
| 45 |
"last_edited_before_era_end": {
|
| 46 |
"date": "2005-09-25",
|
|
@@ -48,9 +61,22 @@
|
|
| 48 |
"tokens": 0
|
| 49 |
},
|
| 50 |
"tokens": {
|
| 51 |
-
"CC-BY-2.5":
|
| 52 |
-
"CC-BY-2.5 AND CC-BY-
|
| 53 |
-
"CC-BY-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
},
|
| 56 |
"review_scope": "licence of contributors' text on pl.wikinews.org and its version per contribution; not independent legal advice",
|
|
|
|
| 31 |
"url": "https://creativecommons.org/licenses/by/2.5/legalcode"
|
| 32 |
}
|
| 33 |
],
|
| 34 |
+
"license": "CC-BY-2.5, CC-BY-4.0 or both per record, by contribution date, plus the licence of imported text",
|
| 35 |
"release_scope": {
|
| 36 |
"created_range": [
|
| 37 |
"2011-12-24",
|
| 38 |
"2026-05-25"
|
| 39 |
],
|
| 40 |
"labels": {
|
| 41 |
+
"CC-BY-2.5": 14663,
|
| 42 |
+
"CC-BY-2.5 AND CC-BY-2.0": 1,
|
| 43 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL": 3709,
|
| 44 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL": 3,
|
| 45 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL": 1108,
|
| 46 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL": 3,
|
| 47 |
+
"CC-BY-2.5 AND CC-BY-3.0": 29,
|
| 48 |
+
"CC-BY-2.5 AND CC-BY-3.0-PL": 25,
|
| 49 |
+
"CC-BY-2.5 AND CC-BY-4.0": 383,
|
| 50 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL": 8,
|
| 51 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL": 1,
|
| 52 |
+
"CC-BY-2.5 AND CC-BY-SA-4.0": 1,
|
| 53 |
+
"CC-BY-2.5 AND CC0-1.0": 1,
|
| 54 |
+
"CC-BY-4.0": 3593,
|
| 55 |
+
"CC-BY-4.0 AND CC-BY-2.5": 3,
|
| 56 |
+
"CC-BY-4.0 AND CC-BY-2.5-PL": 41
|
| 57 |
},
|
| 58 |
"last_edited_before_era_end": {
|
| 59 |
"date": "2005-09-25",
|
|
|
|
| 61 |
"tokens": 0
|
| 62 |
},
|
| 63 |
"tokens": {
|
| 64 |
+
"CC-BY-2.5": 6860606,
|
| 65 |
+
"CC-BY-2.5 AND CC-BY-2.0": 921,
|
| 66 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL": 1692900,
|
| 67 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL": 6316,
|
| 68 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL": 495438,
|
| 69 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL": 3040,
|
| 70 |
+
"CC-BY-2.5 AND CC-BY-3.0": 24511,
|
| 71 |
+
"CC-BY-2.5 AND CC-BY-3.0-PL": 10209,
|
| 72 |
+
"CC-BY-2.5 AND CC-BY-4.0": 326696,
|
| 73 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL": 4718,
|
| 74 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL": 771,
|
| 75 |
+
"CC-BY-2.5 AND CC-BY-SA-4.0": 510,
|
| 76 |
+
"CC-BY-2.5 AND CC0-1.0": 714,
|
| 77 |
+
"CC-BY-4.0": 1500584,
|
| 78 |
+
"CC-BY-4.0 AND CC-BY-2.5": 2327,
|
| 79 |
+
"CC-BY-4.0 AND CC-BY-2.5-PL": 38243
|
| 80 |
}
|
| 81 |
},
|
| 82 |
"review_scope": "licence of contributors' text on pl.wikinews.org and its version per contribution; not independent legal advice",
|
data/wikinews/wikinews.md
CHANGED
|
@@ -6,7 +6,7 @@ Polish Wikinews
|
|
| 6 |
- **Source (upstream):** https://dumps.wikimedia.org/plwikinews/20260601/
|
| 7 |
- **Domain:** news
|
| 8 |
- **Language:** Polish (pl)
|
| 9 |
-
- **License:** `CC-BY-2.5`, `CC-BY-4.0` or both per record (by contribution date)
|
| 10 |
- **Created (range):** 2011-12-24, 2026-05-25 (date of the page's last revision in the dump)
|
| 11 |
- **Added:** 2026-06-15; rebuilt 2026-10-06 (UTC) from the official Wikimedia dump
|
| 12 |
|
|
@@ -17,16 +17,34 @@ Each row is labelled by the contributions its text holds:
|
|
| 17 |
|
| 18 |
| `license` | documents | tokens | share of tokens |
|
| 19 |
|---|---:|---:|---:|
|
| 20 |
-
| `CC-BY-2.5` |
|
| 21 |
-
| `CC-BY-2.5 AND CC-BY-4.0` |
|
| 22 |
-
| `CC-BY-4.0` | 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
A row labelled `CC-BY-2.5 AND CC-BY-4.0` holds text under each licence. It is not split by contribution;
|
| 25 |
its page history tells the two apart. The basis of each label is the sidecar's `license_basis`:
|
| 26 |
|
| 27 |
| `license_basis` | `license` | documents | rule |
|
| 28 |
|---|---|---:|---|
|
| 29 |
-
| `shipped_before_cutoff` | `CC-BY-2.5` | 17,
|
| 30 |
| `same_revision_text` | `CC-BY-2.5` | 602 | the shipped revision has the sha1 of the last pre-cutoff one in the stub dump (e.g. a revert) |
|
| 31 |
| `identical_text` | `CC-BY-2.5` | 1,972 | the last pre-cutoff revision converts to the shipped text, whitespace aside |
|
| 32 |
| `no_text_added` | `CC-BY-2.5` | 78 | later edits only removed words: the shipped words are a subsequence of the pre-cutoff ones |
|
|
@@ -62,7 +80,12 @@ revision alone (`CC-BY-4.0` from 2024-12-16 00:00 UTC).
|
|
| 62 |
|
| 63 |
The terms page puts articles created before 2005-09-25 in the public domain. 1,250 released rows are of pages created
|
| 64 |
before then (their first revision in the stub dump; `created_before_cc_by_2_5` in `license_flags`). The
|
| 65 |
-
public-domain statement is not relied on: they are labelled by contribution like the other rows (1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
Evidence: `wikinews.license-evidence.json`.
|
| 68 |
|
|
@@ -75,6 +98,15 @@ in the dump), `title`, `url`, `last_revision_at`, `license`,
|
|
| 75 |
before the cutoff, null for a page created after it; its text is at `https://pl.wikinews.org/w/index.php?oldid=<pre_cutoff_revid>`), and `license_flags`
|
| 76 |
(the flags described in Licensing, when any apply). The row `id` is
|
| 77 |
`wikinews_<page id>` and `created` is the date of `last_revision_at`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
The text is modified: wiki markup is converted to plain text (see Provenance).
|
| 80 |
|
|
@@ -82,42 +114,55 @@ The text is modified: wiki markup is converted to plain text (see Provenance).
|
|
| 82 |
Parsed from the official Wikimedia dump `plwikinews-20260601-pages-articles` by
|
| 83 |
`src/fetch_wikimedia.py`; the file (21,980,828 bytes, sha1 `bfad5f33667756de4ded97756d370d7fdec39bcb`) was matched against the
|
| 84 |
dump's `dumpstatus.json` and `sha1sums.txt` (`wikinews.build.json`). v0.2.0-v0.2.5 used the same dump
|
| 85 |
-
date; the text set is the same except for the residue cleanup described below (the rebuild adds the last-revision time).
|
| 86 |
|
| 87 |
Articles (namespace 0) only. Redirects, empty pages and pages shorter than 200 characters are skipped.
|
| 88 |
Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5,
|
| 89 |
then `drop_residue` removes what that leaves of category and file links: `Kategoria:...` lines, bare file
|
| 90 |
titles and file-link options (`thumb|250px|...`); captions stay ([v2#116](https://github.com/slayerlabs/polish-dynaword-v2/issues/116)).
|
| 91 |
-
It was applied to the committed text (`fetch_wikimedia.py retext`): 24,
|
| 92 |
-
3,126,
|
| 93 |
characters were dropped, as was 1 whose cleaned text repeated a lower page id's (ids and titles in `wikinews.build.json`). Templates and comments are dropped; `<ref>`
|
| 94 |
bodies stay in the text (the wikipedia fetcher's `strip_article` removes them). Of two pages with the same text
|
| 95 |
(sha1 of the stripped text), the lower page id is kept.
|
| 96 |
|
| 97 |
-
65,253 pages scanned → 47,845 in namespace 0 → 23,366 redirects, 0 empty pages, 0 parser failures, 899 shorter than 200 characters skipped, 1 exact duplicates dropped → 23,
|
| 98 |
|
| 99 |
## Statistics
|
| 100 |
| documents | characters | tokens (tiktoken proxy) |
|
| 101 |
|---:|---:|---:|
|
| 102 |
-
| 23,
|
| 103 |
|
| 104 |
-
v0.2.5 had 24,386 documents, 32,524,646 characters and 12,141,355 tokens; the difference is the residue cleanup (see Provenance).
|
| 105 |
|
| 106 |
## Per-document license metadata
|
| 107 |
| license | documents |
|
| 108 |
|---|---:|
|
| 109 |
-
| `CC-BY-2.5` |
|
| 110 |
-
| `CC-BY-2.5 AND CC-BY-4.0` |
|
| 111 |
-
| `CC-BY-4.0` | 3,
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
## Filters applied (build_dynaword.py)
|
| 116 |
- drop documents < 200 chars: **0** (the fetcher already dropped 899)
|
| 117 |
- drop non-Polish (diacritic ratio): **6**
|
| 118 |
- exact cross-source dedup (sha1): **0**
|
| 119 |
- OCR alpha-ratio < 0.70 (OCR sources only): **0**
|
| 120 |
-
- read 23,
|
| 121 |
|
| 122 |
Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
|
| 123 |
Llama-3 count is computed at release.
|
|
@@ -133,5 +178,5 @@ Llama-3 count is computed at release.
|
|
| 133 |
a line, a link target that prose follows on its line (`link=w:Polska (dziennik) opublikowała...`, 3 rows),
|
| 134 |
and `<ref>` bodies
|
| 135 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 136 |
-
-
|
| 137 |
- personal data (the NERGAL scrub runs before release)
|
|
|
|
| 6 |
- **Source (upstream):** https://dumps.wikimedia.org/plwikinews/20260601/
|
| 7 |
- **Domain:** news
|
| 8 |
- **Language:** Polish (pl)
|
| 9 |
+
- **License:** `CC-BY-2.5`, `CC-BY-4.0` or both per record (by contribution date), plus the licence of imported text (see Licensing)
|
| 10 |
- **Created (range):** 2011-12-24, 2026-05-25 (date of the page's last revision in the dump)
|
| 11 |
- **Added:** 2026-06-15; rebuilt 2026-10-06 (UTC) from the official Wikimedia dump
|
| 12 |
|
|
|
|
| 17 |
|
| 18 |
| `license` | documents | tokens | share of tokens |
|
| 19 |
|---|---:|---:|---:|
|
| 20 |
+
| `CC-BY-2.5` | 14,663 | 6,860,606 | 62.5% |
|
| 21 |
+
| `CC-BY-2.5 AND CC-BY-4.0` | 383 | 326,696 | 3.0% |
|
| 22 |
+
| `CC-BY-4.0` | 3,593 | 1,500,584 | 13.7% |
|
| 23 |
+
| `CC-BY-2.5 AND CC-BY-2.0` | 1 | 921 | 0.0% |
|
| 24 |
+
| `CC-BY-2.5 AND CC-BY-2.0-PL` | 3,709 | 1,692,900 | 15.4% |
|
| 25 |
+
| `CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL` | 3 | 6,316 | 0.1% |
|
| 26 |
+
| `CC-BY-2.5 AND CC-BY-2.5-PL` | 1,108 | 495,438 | 4.5% |
|
| 27 |
+
| `CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL` | 3 | 3,040 | 0.0% |
|
| 28 |
+
| `CC-BY-2.5 AND CC-BY-3.0` | 29 | 24,511 | 0.2% |
|
| 29 |
+
| `CC-BY-2.5 AND CC-BY-3.0-PL` | 25 | 10,209 | 0.1% |
|
| 30 |
+
| `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL` | 8 | 4,718 | 0.0% |
|
| 31 |
+
| `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL` | 1 | 771 | 0.0% |
|
| 32 |
+
| `CC-BY-2.5 AND CC-BY-SA-4.0` | 1 | 510 | 0.0% |
|
| 33 |
+
| `CC-BY-2.5 AND CC0-1.0` | 1 | 714 | 0.0% |
|
| 34 |
+
| `CC-BY-4.0 AND CC-BY-2.5` | 3 | 2,327 | 0.0% |
|
| 35 |
+
| `CC-BY-4.0 AND CC-BY-2.5-PL` | 41 | 38,243 | 0.3% |
|
| 36 |
+
|
| 37 |
+
A label longer than the page's own (`CC-BY-2.5 AND CC-BY-2.0`, `CC-BY-2.5 AND CC-BY-2.0-PL`, `CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL`, `CC-BY-2.5 AND CC-BY-2.5-PL`, `CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL`, `CC-BY-2.5 AND CC-BY-3.0`, `CC-BY-2.5 AND CC-BY-3.0-PL`, `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL`, `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL`, `CC-BY-2.5 AND CC-BY-SA-4.0`, `CC-BY-2.5 AND CC0-1.0`, `CC-BY-4.0 AND CC-BY-2.5`, `CC-BY-4.0 AND CC-BY-2.5-PL`) adds the licence of text the page marks
|
| 38 |
+
as taken from elsewhere or as under another licence: the template that says so is in the sidecar's `source_notes`, and
|
| 39 |
+
the licence is the template's `licencja` argument when it has one, else the one `IMPORT_TEMPLATES` in `src/rights.py` gives that template (`import_licenses` in
|
| 40 |
+
`src/fetch_wikimedia.py`). The `license_basis` table below gives each row's own label.
|
| 41 |
|
| 42 |
A row labelled `CC-BY-2.5 AND CC-BY-4.0` holds text under each licence. It is not split by contribution;
|
| 43 |
its page history tells the two apart. The basis of each label is the sidecar's `license_basis`:
|
| 44 |
|
| 45 |
| `license_basis` | `license` | documents | rule |
|
| 46 |
|---|---|---:|---|
|
| 47 |
+
| `shipped_before_cutoff` | `CC-BY-2.5` | 17,170 | the shipped revision predates the cutoff |
|
| 48 |
| `same_revision_text` | `CC-BY-2.5` | 602 | the shipped revision has the sha1 of the last pre-cutoff one in the stub dump (e.g. a revert) |
|
| 49 |
| `identical_text` | `CC-BY-2.5` | 1,972 | the last pre-cutoff revision converts to the shipped text, whitespace aside |
|
| 50 |
| `no_text_added` | `CC-BY-2.5` | 78 | later edits only removed words: the shipped words are a subsequence of the pre-cutoff ones |
|
|
|
|
| 80 |
|
| 81 |
The terms page puts articles created before 2005-09-25 in the public domain. 1,250 released rows are of pages created
|
| 82 |
before then (their first revision in the stub dump; `created_before_cc_by_2_5` in `license_flags`). The
|
| 83 |
+
public-domain statement is not relied on: they are labelled by contribution like the other rows (1,007 `CC-BY-2.5`, 230 `CC-BY-2.5 AND CC-BY-2.0-PL`, 11 `CC-BY-2.5 AND CC-BY-4.0`, 2 `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL`).
|
| 84 |
+
|
| 85 |
+
Text quoted from other works is not under these licences. It is used under the quotation right
|
| 86 |
+
(Art. 29 of the Polish copyright act), which holds while a quotation stays in its context with its
|
| 87 |
+
author and source named. Each page is released as one record, not cut into quotations, and the
|
| 88 |
+
footnotes and citation templates that name the sources are kept in `citations`.
|
| 89 |
|
| 90 |
Evidence: `wikinews.license-evidence.json`.
|
| 91 |
|
|
|
|
| 98 |
before the cutoff, null for a page created after it; its text is at `https://pl.wikinews.org/w/index.php?oldid=<pre_cutoff_revid>`), and `license_flags`
|
| 99 |
(the flags described in Licensing, when any apply). The row `id` is
|
| 100 |
`wikinews_<page id>` and `created` is the date of `last_revision_at`.
|
| 101 |
+
Each line also gives `permalink` (`https://pl.wikinews.org/w/index.php?oldid=<revid>`, the shipped revision),
|
| 102 |
+
`history_url` (`https://pl.wikinews.org/w/index.php?curid=<pageid>&action=history`, the page history, which names
|
| 103 |
+
the contributors), `license_urls` (the deed of each licence in `license`) and `conversion` (how the text was made
|
| 104 |
+
from the wikitext, in one line). Neither link opens for a page deleted since.
|
| 105 |
+
The history is the article's list of authors; it credits them on every row, the 1,250 rows of pages created
|
| 106 |
+
before 2005-09-25 included. No usernames are copied.
|
| 107 |
+
`citations` lists the page's source citations as wikitext: the non-empty `<ref>` bodies, then the
|
| 108 |
+
`Cytuj...`/`Cite...` templates, `{{Źródło}}`, `{{Źródło IAR}}`, `{{Źródło PAP}}` outside them (13,968 rows have any). `source_notes` lists the templates
|
| 109 |
+
that say where text came from or under what licence: `{{Cia.bzzz.net}}`, `{{Cia.media.pl}}`, `{{Doorg cc-by 2.5 Polska}}`, `{{E-polityka}}`, `{{E-polityka.pl}}`, `{{Media2.pl}}`, `{{OSWorld}}`, `{{Pro-cycling}}`, `{{Przetłumaczony}}`, `{{S24.pl}}`, `{{Zaimportowany}}` (5,777 rows have any). Each list is in page order, without repeats.
|
| 110 |
|
| 111 |
The text is modified: wiki markup is converted to plain text (see Provenance).
|
| 112 |
|
|
|
|
| 114 |
Parsed from the official Wikimedia dump `plwikinews-20260601-pages-articles` by
|
| 115 |
`src/fetch_wikimedia.py`; the file (21,980,828 bytes, sha1 `bfad5f33667756de4ded97756d370d7fdec39bcb`) was matched against the
|
| 116 |
dump's `dumpstatus.json` and `sha1sums.txt` (`wikinews.build.json`). v0.2.0-v0.2.5 used the same dump
|
| 117 |
+
date; the text set is the same except for the 1 page withheld by the rights review and the residue cleanup described below (the rebuild adds the last-revision time).
|
| 118 |
|
| 119 |
Articles (namespace 0) only. Redirects, empty pages and pages shorter than 200 characters are skipped.
|
| 120 |
Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5,
|
| 121 |
then `drop_residue` removes what that leaves of category and file links: `Kategoria:...` lines, bare file
|
| 122 |
titles and file-link options (`thumb|250px|...`); captions stay ([v2#116](https://github.com/slayerlabs/polish-dynaword-v2/issues/116)).
|
| 123 |
+
It was applied to the committed text (`fetch_wikimedia.py retext`): 24,206 rows changed,
|
| 124 |
+
3,126,538 characters and 1,172,397 tokens removed, and 812 pages that fell under 200
|
| 125 |
characters were dropped, as was 1 whose cleaned text repeated a lower page id's (ids and titles in `wikinews.build.json`). Templates and comments are dropped; `<ref>`
|
| 126 |
bodies stay in the text (the wikipedia fetcher's `strip_article` removes them). Of two pages with the same text
|
| 127 |
(sha1 of the stripped text), the lower page id is kept.
|
| 128 |
|
| 129 |
+
65,253 pages scanned → 47,845 in namespace 0 → 23,366 redirects, 0 empty pages, 0 parser failures, 899 shorter than 200 characters skipped, 1 exact duplicates dropped, 1 page withheld by the rights review (`DROPPED_PAGES` in `src/rights.py`; ids, titles and reasons in `wikinews.build.json`) → 23,578 read by the build → 23,572 released.
|
| 130 |
|
| 131 |
## Statistics
|
| 132 |
| documents | characters | tokens (tiktoken proxy) |
|
| 133 |
|---:|---:|---:|
|
| 134 |
+
| 23,572 | 29,396,894 | 10,968,504 |
|
| 135 |
|
| 136 |
+
v0.2.5 had 24,386 documents, 32,524,646 characters and 12,141,355 tokens; the difference is the 1 page withheld by the rights review and the residue cleanup (see Provenance).
|
| 137 |
|
| 138 |
## Per-document license metadata
|
| 139 |
| license | documents |
|
| 140 |
|---|---:|
|
| 141 |
+
| `CC-BY-2.5` | 14,663 |
|
| 142 |
+
| `CC-BY-2.5 AND CC-BY-4.0` | 383 |
|
| 143 |
+
| `CC-BY-4.0` | 3,593 |
|
| 144 |
+
| `CC-BY-2.5 AND CC-BY-2.0` | 1 |
|
| 145 |
+
| `CC-BY-2.5 AND CC-BY-2.0-PL` | 3,709 |
|
| 146 |
+
| `CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL` | 3 |
|
| 147 |
+
| `CC-BY-2.5 AND CC-BY-2.5-PL` | 1,108 |
|
| 148 |
+
| `CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL` | 3 |
|
| 149 |
+
| `CC-BY-2.5 AND CC-BY-3.0` | 29 |
|
| 150 |
+
| `CC-BY-2.5 AND CC-BY-3.0-PL` | 25 |
|
| 151 |
+
| `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL` | 8 |
|
| 152 |
+
| `CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL` | 1 |
|
| 153 |
+
| `CC-BY-2.5 AND CC-BY-SA-4.0` | 1 |
|
| 154 |
+
| `CC-BY-2.5 AND CC0-1.0` | 1 |
|
| 155 |
+
| `CC-BY-4.0 AND CC-BY-2.5` | 3 |
|
| 156 |
+
| `CC-BY-4.0 AND CC-BY-2.5-PL` | 41 |
|
| 157 |
+
|
| 158 |
+
Author metadata present for **23,572** documents.
|
| 159 |
|
| 160 |
## Filters applied (build_dynaword.py)
|
| 161 |
- drop documents < 200 chars: **0** (the fetcher already dropped 899)
|
| 162 |
- drop non-Polish (diacritic ratio): **6**
|
| 163 |
- exact cross-source dedup (sha1): **0**
|
| 164 |
- OCR alpha-ratio < 0.70 (OCR sources only): **0**
|
| 165 |
+
- read 23,578 → kept 23,572
|
| 166 |
|
| 167 |
Token counts are a fast tiktoken (cl100k) proxy (~1% off Llama-3); the canonical
|
| 168 |
Llama-3 count is computed at release.
|
|
|
|
| 178 |
a line, a link target that prose follows on its line (`link=w:Polska (dziennik) opublikowała...`, 3 rows),
|
| 179 |
and `<ref>` bodies
|
| 180 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 181 |
+
- whether each quotation inside articles stays within Art. 29 (see Licensing)
|
| 182 |
- personal data (the NERGAL scrub runs before release)
|
data/wikinews/wikinews.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dcc13dca6f6f3dc9d5a84b20d2d67bf319670f6f135515f5c180830f8a7e14cc
|
| 3 |
+
size 14568323
|
data/wikinews/wikinews.stats.json
CHANGED
|
@@ -1,18 +1,31 @@
|
|
| 1 |
{
|
| 2 |
-
"read":
|
| 3 |
-
"kept":
|
| 4 |
"drop_short": 0,
|
| 5 |
"drop_lang": 6,
|
| 6 |
"drop_dup": 0,
|
| 7 |
"drop_ocr": 0,
|
| 8 |
-
"chars":
|
| 9 |
-
"tokens":
|
| 10 |
"licenses": {
|
| 11 |
-
"CC-BY-4.0":
|
| 12 |
-
"CC-BY-2.5":
|
| 13 |
-
"CC-BY-2.5 AND CC-BY-4.0":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
},
|
| 15 |
-
"authors_with_value":
|
| 16 |
"secs": 1.4,
|
| 17 |
-
"license": "CC BY (2.5, 4.0 or both per record, by contribution date)"
|
| 18 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"read": 23578,
|
| 3 |
+
"kept": 23572,
|
| 4 |
"drop_short": 0,
|
| 5 |
"drop_lang": 6,
|
| 6 |
"drop_dup": 0,
|
| 7 |
"drop_ocr": 0,
|
| 8 |
+
"chars": 29396894,
|
| 9 |
+
"tokens": 10968504,
|
| 10 |
"licenses": {
|
| 11 |
+
"CC-BY-4.0": 3593,
|
| 12 |
+
"CC-BY-2.5": 14663,
|
| 13 |
+
"CC-BY-2.5 AND CC-BY-4.0": 383,
|
| 14 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL": 1108,
|
| 15 |
+
"CC-BY-2.5 AND CC-BY-3.0": 29,
|
| 16 |
+
"CC-BY-2.5 AND CC-BY-SA-4.0": 1,
|
| 17 |
+
"CC-BY-2.5 AND CC-BY-3.0-PL": 25,
|
| 18 |
+
"CC-BY-2.5 AND CC0-1.0": 1,
|
| 19 |
+
"CC-BY-2.5 AND CC-BY-2.0": 1,
|
| 20 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL": 3709,
|
| 21 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL": 8,
|
| 22 |
+
"CC-BY-4.0 AND CC-BY-2.5": 3,
|
| 23 |
+
"CC-BY-4.0 AND CC-BY-2.5-PL": 41,
|
| 24 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL": 3,
|
| 25 |
+
"CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL": 3,
|
| 26 |
+
"CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL": 1
|
| 27 |
},
|
| 28 |
+
"authors_with_value": 23572,
|
| 29 |
"secs": 1.4,
|
| 30 |
+
"license": "CC BY (2.5, 4.0 or both per record, by contribution date, plus the licence of imported text)"
|
| 31 |
}
|
src/fetch_wikimedia.py
CHANGED
|
@@ -688,7 +688,8 @@ def relabel(out: Path, data_dir: Path, key: str) -> None:
|
|
| 688 |
docs, tokens = write_labels(out, data_dir, key, site["wiki"], site["cutoff"])
|
| 689 |
path = data_dir / f"{key}.license-evidence.json"
|
| 690 |
ev = load(path)
|
| 691 |
-
ev["license"] = f"{site['before']}, {site['after']} or both per record, by contribution date"
|
|
|
|
| 692 |
ev["review_scope"] = f"licence of contributors' text on {site['host']} and its version per contribution; not independent legal advice"
|
| 693 |
ev["release_scope"].update(labels=docs, tokens=tokens)
|
| 694 |
if "window_end" in (cfg := WIKIS[key]): # wikinews: `cutoff.at` is prepare's last-revision day, the labels use the window
|
|
@@ -935,7 +936,8 @@ def datasheet(out: Path, data_dir: Path, key: str) -> None:
|
|
| 935 |
if n_template != prep.get("withheld_template", 0):
|
| 936 |
raise ValueError(f"{key}: withheld_by_template lists {n_template} pages, prepare.counts says {prep.get('withheld_template', 0)}")
|
| 937 |
clean = build.get("residue_cleanup")
|
| 938 |
-
|
|
|
|
| 939 |
v025 = ("The same text set as v0.2.5: documents, characters and tokens are unchanged; only labels, ids, authors and dates differ."
|
| 940 |
if same else f"v0.2.5 had {v_docs:,} documents, {v_chars:,} characters and {v_tokens:,} tokens"
|
| 941 |
+ (f"; the difference is {' and '.join(why)}{' (see Provenance)' * bool(clean)}." if why else "."))
|
|
@@ -989,7 +991,7 @@ text (sha1 of the stripped text), the lower page id is kept."""
|
|
| 989 |
f"{prep.get('ns0_strip_error', 0):,} parser failures", f"{prep.get('ns0_short', 0):,} shorter than {MIN_CHARS} characters"]
|
| 990 |
chain = (f"{prep['pages']:,} pages scanned → {prep['ns0']:,} in namespace 0 → " + ", ".join(skipped) + " skipped"
|
| 991 |
+ (f", {prep['exact_duplicate']:,} exact duplicates dropped" if prep.get("exact_duplicate") else ", no exact duplicates")
|
| 992 |
-
+ (f", {n_dropped:,}
|
| 993 |
if n_dropped else "")
|
| 994 |
+ (f", {n_template:,} pages withheld for a template they carry (`WITHHELD_TEMPLATES` in `src/rights.py`; ids and titles in `{key}.build.json`)"
|
| 995 |
if n_template else "")
|
|
|
|
| 688 |
docs, tokens = write_labels(out, data_dir, key, site["wiki"], site["cutoff"])
|
| 689 |
path = data_dir / f"{key}.license-evidence.json"
|
| 690 |
ev = load(path)
|
| 691 |
+
ev["license"] = (f"{site['before']}, {site['after']} or both per record, by contribution date"
|
| 692 |
+
+ ", plus the licence of imported text" * (len(label_order(site["before"], site["after"], docs)) > 3))
|
| 693 |
ev["review_scope"] = f"licence of contributors' text on {site['host']} and its version per contribution; not independent legal advice"
|
| 694 |
ev["release_scope"].update(labels=docs, tokens=tokens)
|
| 695 |
if "window_end" in (cfg := WIKIS[key]): # wikinews: `cutoff.at` is prepare's last-revision day, the labels use the window
|
|
|
|
| 936 |
if n_template != prep.get("withheld_template", 0):
|
| 937 |
raise ValueError(f"{key}: withheld_by_template lists {n_template} pages, prepare.counts says {prep.get('withheld_template', 0)}")
|
| 938 |
clean = build.get("residue_cleanup")
|
| 939 |
+
held = n_dropped + n_template
|
| 940 |
+
why = [f"the {held:,} page{'s' * (held != 1)} withheld by the rights review"] * bool(held) + ["the residue cleanup"] * bool(clean)
|
| 941 |
v025 = ("The same text set as v0.2.5: documents, characters and tokens are unchanged; only labels, ids, authors and dates differ."
|
| 942 |
if same else f"v0.2.5 had {v_docs:,} documents, {v_chars:,} characters and {v_tokens:,} tokens"
|
| 943 |
+ (f"; the difference is {' and '.join(why)}{' (see Provenance)' * bool(clean)}." if why else "."))
|
|
|
|
| 991 |
f"{prep.get('ns0_strip_error', 0):,} parser failures", f"{prep.get('ns0_short', 0):,} shorter than {MIN_CHARS} characters"]
|
| 992 |
chain = (f"{prep['pages']:,} pages scanned → {prep['ns0']:,} in namespace 0 → " + ", ".join(skipped) + " skipped"
|
| 993 |
+ (f", {prep['exact_duplicate']:,} exact duplicates dropped" if prep.get("exact_duplicate") else ", no exact duplicates")
|
| 994 |
+
+ (f", {n_dropped:,} page{'s' * (n_dropped != 1)} withheld by the rights review (`DROPPED_PAGES` in `src/rights.py`; ids, titles and reasons in `{key}.build.json`)"
|
| 995 |
if n_dropped else "")
|
| 996 |
+ (f", {n_template:,} pages withheld for a template they carry (`WITHHELD_TEMPLATES` in `src/rights.py`; ids and titles in `{key}.build.json`)"
|
| 997 |
if n_template else "")
|
src/rights.py
CHANGED
|
@@ -84,6 +84,9 @@ _GFDL_LATE = "after 2008-11-01, so the 2009 relicensing of GFDL text to CC BY-SA
|
|
| 84 |
# repeats it is dropped as its duplicate. Each source's block is edited by its own PR.
|
| 85 |
DROPPED_PAGES: dict[str, dict[int, str]] = {
|
| 86 |
"wikinews": {
|
|
|
|
|
|
|
|
|
|
| 87 |
},
|
| 88 |
"wikivoyage": {
|
| 89 |
1219: "Barcelona/Sagrada Família: edited from barcelona.przewodnik-turystyczny.pl (the page's own "
|
|
@@ -173,5 +176,5 @@ if __name__ == "__main__": # self-check
|
|
| 173 |
assert spdx("http://creativecommons.org/publicdomain/mark/1.0/") == "public-domain (PDM-1.0)"
|
| 174 |
assert license_for_revision("2023-06-06T23:59:59Z") == "CC-BY-SA-3.0"
|
| 175 |
assert license_for_revision("2023-06-07T00:00:00Z") == "CC-BY-SA-4.0"
|
| 176 |
-
check_dropped_reached("wikinews", [])
|
| 177 |
print("ok")
|
|
|
|
| 84 |
# repeats it is dropped as its duplicate. Each source's block is edited by its own PR.
|
| 85 |
DROPPED_PAGES: dict[str, dict[int, str]] = {
|
| 86 |
"wikinews": {
|
| 87 |
+
55256: "2021-09-12: „Ostatni telefon z WTC” – 4. odcinek Klubu Ludzi Ciekawych Wszystkiego: carries "
|
| 88 |
+
"{{Zaimportowany}} pointing to the episode's page on podkasty.info, and its text repeats the episode's "
|
| 89 |
+
"blurb (\"porozmawiamy\", \"Oto nasi goście\"); neither the template nor the site states a licence",
|
| 90 |
},
|
| 91 |
"wikivoyage": {
|
| 92 |
1219: "Barcelona/Sagrada Família: edited from barcelona.przewodnik-turystyczny.pl (the page's own "
|
|
|
|
| 176 |
assert spdx("http://creativecommons.org/publicdomain/mark/1.0/") == "public-domain (PDM-1.0)"
|
| 177 |
assert license_for_revision("2023-06-06T23:59:59Z") == "CC-BY-SA-3.0"
|
| 178 |
assert license_for_revision("2023-06-07T00:00:00Z") == "CC-BY-SA-4.0"
|
| 179 |
+
check_dropped_reached("wikinews", [55256])
|
| 180 |
print("ok")
|
src/sources.py
CHANGED
|
@@ -515,7 +515,7 @@ SOURCES = {
|
|
| 515 |
"time. The licence labels come from the page histories "
|
| 516 |
"(stub-meta-history dump plwikinews-20261001, "
|
| 517 |
"src/wiki_history.py).",
|
| 518 |
-
"license": "CC BY (2.5, 4.0 or both per record, by contribution date)",
|
| 519 |
"license_spdx": "MIXED",
|
| 520 |
"traceable": "pl.wikinews licenses its content CC BY 2.5 until 2024-12-16 and "
|
| 521 |
"CC BY 4.0 from that day (its terms page), and each contribution "
|
|
|
|
| 515 |
"time. The licence labels come from the page histories "
|
| 516 |
"(stub-meta-history dump plwikinews-20261001, "
|
| 517 |
"src/wiki_history.py).",
|
| 518 |
+
"license": "CC BY (2.5, 4.0 or both per record, by contribution date, plus the licence of imported text)",
|
| 519 |
"license_spdx": "MIXED",
|
| 520 |
"traceable": "pl.wikinews licenses its content CC BY 2.5 until 2024-12-16 and "
|
| 521 |
"CC BY 4.0 from that day (its terms page), and each contribution "
|
src/test_wikinews_contract.py
CHANGED
|
@@ -7,28 +7,46 @@ import re
|
|
| 7 |
import pyarrow.parquet as pq
|
| 8 |
|
| 9 |
import fetch_wikimedia as fm
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
def test_wikinews_contract(tmp_path):
|
| 14 |
-
stats, ev = check_released("wikinews", tmp_path)
|
| 15 |
-
assert (
|
| 16 |
-
|
|
|
|
| 17 |
data = ROOT / "data" / "wikinews"
|
| 18 |
build = json.loads((data / "wikinews.build.json").read_text(encoding="utf-8"))
|
| 19 |
clean = build["residue_cleanup"]
|
| 20 |
-
assert clean["rows_changed"] ==
|
| 21 |
assert len(clean["dropped_short"]) == 812
|
| 22 |
assert [(r["id"], r["duplicate_of"]) for r in clean["dropped_duplicate"]] == [("wikinews_24619", "wikinews_24618")]
|
| 23 |
# no line holds only an option word (371 rows had one, the leftover of "[[Plik:X.jpg|mały]]")
|
| 24 |
lone = re.compile(rf"[ \t]*{fm.OPTION_LAST}[ \t]*") # the shape of an option at the end of a line
|
| 25 |
texts = pq.read_table(data / "wikinews.parquet", columns=["text"]).column("text").to_pylist()
|
| 26 |
assert not [t for t in texts if any(map(lone.fullmatch, t.split("\n")))]
|
| 27 |
-
# labelled by contribution (v2#110): 2.5, 4.0 or both, with the switch window as both
|
| 28 |
-
|
| 29 |
-
assert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
labels = build["licence_labels"]
|
| 31 |
-
assert labels["cases"] == {"shipped_before_cutoff":
|
| 32 |
"created_after_cutoff": 3637, "created_in_switch_window": 15, "changed_after_cutoff": 98}
|
| 33 |
assert labels["stub"]["sha1"] == "4ad674a218e1fc70b2ace9ad95e4e682fda6f3d7"
|
| 34 |
with (data / "wikinews.attribution.jsonl").open(encoding="utf-8") as fh:
|
|
|
|
| 7 |
import pyarrow.parquet as pq
|
| 8 |
|
| 9 |
import fetch_wikimedia as fm
|
| 10 |
+
import rights
|
| 11 |
+
from test_wikimedia_contract import ROOT, check_released, provenance_counts
|
| 12 |
+
|
| 13 |
+
# the v0.2.5 row (documents, characters, tokens) that the rights review withholds: a podcast episode's blurb (pageid 55256)
|
| 14 |
+
WITHHELD = (1, 1214, 454)
|
| 15 |
|
| 16 |
|
| 17 |
def test_wikinews_contract(tmp_path):
|
| 18 |
+
stats, ev = check_released("wikinews", tmp_path, dropped=WITHHELD)
|
| 19 |
+
assert set(rights.DROPPED_PAGES["wikinews"]) == {55256}
|
| 20 |
+
assert (stats["kept"], stats["tokens"]) == (23572, 10968504)
|
| 21 |
+
# v2#116: drop_residue changed 24,206 rows; 812 pages fell under 200 characters and one repeated another's text
|
| 22 |
data = ROOT / "data" / "wikinews"
|
| 23 |
build = json.loads((data / "wikinews.build.json").read_text(encoding="utf-8"))
|
| 24 |
clean = build["residue_cleanup"]
|
| 25 |
+
assert clean["rows_changed"] == 24206 and clean["before"] == {"docs": 24385, "chars": 32523432, "tokens": 12140901}
|
| 26 |
assert len(clean["dropped_short"]) == 812
|
| 27 |
assert [(r["id"], r["duplicate_of"]) for r in clean["dropped_duplicate"]] == [("wikinews_24619", "wikinews_24618")]
|
| 28 |
# no line holds only an option word (371 rows had one, the leftover of "[[Plik:X.jpg|mały]]")
|
| 29 |
lone = re.compile(rf"[ \t]*{fm.OPTION_LAST}[ \t]*") # the shape of an option at the end of a line
|
| 30 |
texts = pq.read_table(data / "wikinews.parquet", columns=["text"]).column("text").to_pylist()
|
| 31 |
assert not [t for t in texts if any(map(lone.fullmatch, t.split("\n")))]
|
| 32 |
+
# labelled by contribution (v2#110): 2.5, 4.0 or both, with the switch window as both, then the licences of
|
| 33 |
+
# imported text added in page order (2A); "CC-BY-2.5 AND CC-BY-4.0" also holds 2.5 pages importing CC BY 4.0 text
|
| 34 |
+
assert stats["licenses"] == {
|
| 35 |
+
"CC-BY-2.5": 14663, "CC-BY-2.5 AND CC-BY-4.0": 383, "CC-BY-4.0": 3593,
|
| 36 |
+
"CC-BY-2.5 AND CC-BY-2.0": 1, "CC-BY-2.5 AND CC-BY-2.0-PL": 3709, "CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL": 3,
|
| 37 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL": 1108, "CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL": 3, "CC-BY-2.5 AND CC-BY-3.0": 29,
|
| 38 |
+
"CC-BY-2.5 AND CC-BY-3.0-PL": 25, "CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL": 8, "CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL": 1,
|
| 39 |
+
"CC-BY-2.5 AND CC-BY-SA-4.0": 1, "CC-BY-2.5 AND CC0-1.0": 1, "CC-BY-4.0 AND CC-BY-2.5": 3, "CC-BY-4.0 AND CC-BY-2.5-PL": 41}
|
| 40 |
+
assert ev["release_scope"]["tokens"] == {
|
| 41 |
+
"CC-BY-2.5": 6860606, "CC-BY-2.5 AND CC-BY-4.0": 326696, "CC-BY-4.0": 1500584,
|
| 42 |
+
"CC-BY-2.5 AND CC-BY-2.0": 921, "CC-BY-2.5 AND CC-BY-2.0-PL": 1692900, "CC-BY-2.5 AND CC-BY-2.0-PL AND CC-BY-2.5-PL": 6316,
|
| 43 |
+
"CC-BY-2.5 AND CC-BY-2.5-PL": 495438, "CC-BY-2.5 AND CC-BY-2.5-PL AND CC-BY-2.0-PL": 3040, "CC-BY-2.5 AND CC-BY-3.0": 24511,
|
| 44 |
+
"CC-BY-2.5 AND CC-BY-3.0-PL": 10209, "CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.0-PL": 4718, "CC-BY-2.5 AND CC-BY-4.0 AND CC-BY-2.5-PL": 771,
|
| 45 |
+
"CC-BY-2.5 AND CC-BY-SA-4.0": 510, "CC-BY-2.5 AND CC0-1.0": 714, "CC-BY-4.0 AND CC-BY-2.5": 2327, "CC-BY-4.0 AND CC-BY-2.5-PL": 38243}
|
| 46 |
+
assert ev["license"] == "CC-BY-2.5, CC-BY-4.0 or both per record, by contribution date, plus the licence of imported text"
|
| 47 |
+
assert provenance_counts("wikinews") == (13968, 5777) # citations; templates marking imported text (3B)
|
| 48 |
labels = build["licence_labels"]
|
| 49 |
+
assert labels["cases"] == {"shipped_before_cutoff": 17170, "same_revision_text": 602, "identical_text": 1972, "no_text_added": 78,
|
| 50 |
"created_after_cutoff": 3637, "created_in_switch_window": 15, "changed_after_cutoff": 98}
|
| 51 |
assert labels["stub"]["sha1"] == "4ad674a218e1fc70b2ace9ad95e4e682fda6f3d7"
|
| 52 |
with (data / "wikinews.attribution.jsonl").open(encoding="utf-8") as fh:
|