wikivoyage: drop lone file-link option lines (v2#116), rebuild four table rows, relabel (v2#110) (#133)
Browse files- wikivoyage: drop lone file-link option lines (v2#116), rebuild four table rows, relabel (v2#110) (d65ffc239db02e33f7034be31e1496dd7fd242f8)
- artifacts/source_findings.md +27 -0
- data/wikivoyage/wikivoyage.build.json +4 -3
- data/wikivoyage/wikivoyage.license-evidence.json +3 -3
- data/wikivoyage/wikivoyage.md +8 -8
- data/wikivoyage/wikivoyage.parquet +2 -2
- data/wikivoyage/wikivoyage.stats.json +2 -2
- src/fetch_wikimedia.py +2 -2
- src/test_wikivoyage_contract.py +9 -4
artifacts/source_findings.md
CHANGED
|
@@ -2877,3 +2877,30 @@ characters, +214 tokens, labels unchanged. In wikivoyage and wikibooks the new r
|
|
| 2877 |
|
| 2878 |
**Blockers** — none to merge. Until the wikivoyage and wikibooks releases are cleaned with the same
|
| 2879 |
rule (their own PRs, next), their contract tests fail on `drop_residue(text) == text`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2877 |
|
| 2878 |
**Blockers** — none to merge. Until the wikivoyage and wikibooks releases are cleaned with the same
|
| 2879 |
rule (their own PRs, next), their contract tests fail on `drop_residue(text) == text`.
|
| 2880 |
+
|
| 2881 |
+
## wikivoyage — lone option lines removed, four table rows rebuilt (update to the sections above)
|
| 2882 |
+
|
| 2883 |
+
**Investigated** — 2026-10-18 (slayerlabs/polish-dynaword-v2#116: the rule of the wikinews section
|
| 2884 |
+
above, applied to this release).
|
| 2885 |
+
|
| 2886 |
+
**Verdict** — `kept`, text cleaned again and relabelled: 13,640 documents, 44,720,085 characters,
|
| 2887 |
+
16,959,169 tokens (was 44,719,971 / 16,959,180). Labels per record unchanged in count:
|
| 2888 |
+
`CC-BY-SA-3.0` 11,220 documents (6,163,588 tokens, 36.3%), `CC-BY-SA-3.0 AND CC-BY-SA-4.0` 1,672
|
| 2889 |
+
(9,834,703, 58.0%), `CC-BY-SA-4.0` 748 (960,878, 5.7%).
|
| 2890 |
+
|
| 2891 |
+
**Effect** — 18 rows lose 24 lines (`mały` 23, `right` 1; in 6 rows the first line), 124 characters
|
| 2892 |
+
and 72 tokens. One of them (`wikivoyage_5942`) had no other residue, so the cleanup now changed
|
| 2893 |
+
13,172 rows. No page fell under 200 characters. The rerun started from the data before Hub PR 125
|
| 2894 |
+
(commit `ae3214b`) and ran `retext`, then `wiki_history.py` `scan`, `fetch` and `compare` on the same
|
| 2895 |
+
stub dump (sha1 `6ca8ea9e…`), `relabel` and `datasheet`. The labels file differs in three rows (`wikivoyage_2833`, `5396`, `15013`), each counting one added word
|
| 2896 |
+
fewer; all three stay `CC-BY-SA-3.0 AND CC-BY-SA-4.0`.
|
| 2897 |
+
|
| 2898 |
+
**Table rows rebuilt** — the rebuild also carries the table-start fix of the wikibooks section above
|
| 2899 |
+
to the four rows released with a lone `{` (`wikivoyage_2055`, `2564`, `9129`, `10490`): each `{`
|
| 2900 |
+
line is again the table start `{| class="wikitable"` (in `10490` `prettytable`, in `2564` with
|
| 2901 |
+
`mw-collapsible mw-collapsed`), adding 238 characters and 61 tokens. With the previous rule the
|
| 2902 |
+
chain gives main except these four rows, which the main code builds this way too.
|
| 2903 |
+
`build.json` gains an empty `dropped_duplicate` list, which `retext` has written since Hub PR 130.
|
| 2904 |
+
|
| 2905 |
+
**Blockers** — none to merge. Until the wikibooks release is cleaned with the same rule (its own PR,
|
| 2906 |
+
next), its contract test fails on `drop_residue(text) == text`.
|
data/wikivoyage/wikivoyage.build.json
CHANGED
|
@@ -63,15 +63,16 @@
|
|
| 63 |
},
|
| 64 |
"residue_cleanup": {
|
| 65 |
"after": {
|
| 66 |
-
"chars":
|
| 67 |
"docs": 13640,
|
| 68 |
-
"tokens":
|
| 69 |
},
|
| 70 |
"before": {
|
| 71 |
"chars": 45176480,
|
| 72 |
"docs": 13643,
|
| 73 |
"tokens": 17125240
|
| 74 |
},
|
|
|
|
| 75 |
"dropped_short": [
|
| 76 |
{
|
| 77 |
"chars": 188,
|
|
@@ -90,7 +91,7 @@
|
|
| 90 |
}
|
| 91 |
],
|
| 92 |
"issue": "slayerlabs/polish-dynaword-v2#116",
|
| 93 |
-
"rows_changed":
|
| 94 |
"step": "fetch_wikimedia.drop_residue"
|
| 95 |
},
|
| 96 |
"rightsinfo": {
|
|
|
|
| 63 |
},
|
| 64 |
"residue_cleanup": {
|
| 65 |
"after": {
|
| 66 |
+
"chars": 44720085,
|
| 67 |
"docs": 13640,
|
| 68 |
+
"tokens": 16959169
|
| 69 |
},
|
| 70 |
"before": {
|
| 71 |
"chars": 45176480,
|
| 72 |
"docs": 13643,
|
| 73 |
"tokens": 17125240
|
| 74 |
},
|
| 75 |
+
"dropped_duplicate": [],
|
| 76 |
"dropped_short": [
|
| 77 |
{
|
| 78 |
"chars": 188,
|
|
|
|
| 91 |
}
|
| 92 |
],
|
| 93 |
"issue": "slayerlabs/polish-dynaword-v2#116",
|
| 94 |
+
"rows_changed": 13172,
|
| 95 |
"step": "fetch_wikimedia.drop_residue"
|
| 96 |
},
|
| 97 |
"rightsinfo": {
|
data/wikivoyage/wikivoyage.license-evidence.json
CHANGED
|
@@ -40,9 +40,9 @@
|
|
| 40 |
"tokens": 0
|
| 41 |
},
|
| 42 |
"tokens": {
|
| 43 |
-
"CC-BY-SA-3.0":
|
| 44 |
-
"CC-BY-SA-3.0 AND CC-BY-SA-4.0":
|
| 45 |
-
"CC-BY-SA-4.0":
|
| 46 |
}
|
| 47 |
},
|
| 48 |
"review_scope": "licence of contributors' text on pl.wikivoyage.org and its version per contribution; not independent legal advice",
|
|
|
|
| 40 |
"tokens": 0
|
| 41 |
},
|
| 42 |
"tokens": {
|
| 43 |
+
"CC-BY-SA-3.0": 6163588,
|
| 44 |
+
"CC-BY-SA-3.0 AND CC-BY-SA-4.0": 9834703,
|
| 45 |
+
"CC-BY-SA-4.0": 960878
|
| 46 |
}
|
| 47 |
},
|
| 48 |
"review_scope": "licence of contributors' text on pl.wikivoyage.org and its version per contribution; not independent legal advice",
|
data/wikivoyage/wikivoyage.md
CHANGED
|
@@ -17,9 +17,9 @@ Each row is labelled by the contributions its text holds:
|
|
| 17 |
|
| 18 |
| `license` | documents | tokens | share of tokens |
|
| 19 |
|---|---:|---:|---:|
|
| 20 |
-
| `CC-BY-SA-3.0` | 11,220 | 6,163,
|
| 21 |
-
| `CC-BY-SA-3.0 AND CC-BY-SA-4.0` | 1,672 | 9,834,
|
| 22 |
-
| `CC-BY-SA-4.0` | 748 | 960,
|
| 23 |
|
| 24 |
A row labelled `CC-BY-SA-3.0 AND CC-BY-SA-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`:
|
|
@@ -78,8 +78,8 @@ Articles (namespace 0) only. Redirects, empty pages and pages shorter than 200 c
|
|
| 78 |
Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5,
|
| 79 |
then `drop_residue` removes what that leaves of category and file links: `Kategoria:...` lines, bare file
|
| 80 |
titles and file-link options (`thumb|250px|...`); captions stay ([v2#116](https://github.com/slayerlabs/polish-dynaword-v2/issues/116)).
|
| 81 |
-
It was applied to the committed text (`fetch_wikimedia.py retext`): 13,
|
| 82 |
-
456,
|
| 83 |
characters were dropped (ids and titles in `wikivoyage.build.json`). Templates and comments are dropped; `<ref>`
|
| 84 |
bodies stay in the text (the wikipedia fetcher's `strip_article` removes them). Of two pages with the same text
|
| 85 |
(sha1 of the stripped text), the lower page id is kept.
|
|
@@ -89,7 +89,7 @@ bodies stay in the text (the wikipedia fetcher's `strip_article` removes them).
|
|
| 89 |
## Statistics
|
| 90 |
| documents | characters | tokens (tiktoken proxy) |
|
| 91 |
|---:|---:|---:|
|
| 92 |
-
| 13,640 | 44,
|
| 93 |
|
| 94 |
v0.2.5 had 13,645 documents, 45,184,300 characters and 17,128,200 tokens; the difference is the 2 pages withheld by the rights review and the residue cleanup (see Provenance).
|
| 95 |
|
|
@@ -118,8 +118,8 @@ Llama-3 count is computed at release.
|
|
| 118 |
`CC-BY-SA-3.0 AND CC-BY-SA-4.0`, with no threshold
|
| 119 |
- text moved or merged from an older page into a page created after the cutoff (labelled `CC-BY-SA-4.0` alone)
|
| 120 |
- the time of day of the switch (see Licensing)
|
| 121 |
-
- what `drop_residue` leaves: file-link options glued to the word before them (`Ladadikathumb|...`),
|
| 122 |
-
|
| 123 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 124 |
- text first contributed under GFDL before the 2009 move to CC BY-SA, and GFDL dual
|
| 125 |
licensing; only the CC BY-SA grant is relied on
|
|
|
|
| 17 |
|
| 18 |
| `license` | documents | tokens | share of tokens |
|
| 19 |
|---|---:|---:|---:|
|
| 20 |
+
| `CC-BY-SA-3.0` | 11,220 | 6,163,588 | 36.3% |
|
| 21 |
+
| `CC-BY-SA-3.0 AND CC-BY-SA-4.0` | 1,672 | 9,834,703 | 58.0% |
|
| 22 |
+
| `CC-BY-SA-4.0` | 748 | 960,878 | 5.7% |
|
| 23 |
|
| 24 |
A row labelled `CC-BY-SA-3.0 AND CC-BY-SA-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`:
|
|
|
|
| 78 |
Wikitext is converted with mwparserfromhell `strip_code(normalize=True, collapse=True)`, as in v0.2.5,
|
| 79 |
then `drop_residue` removes what that leaves of category and file links: `Kategoria:...` lines, bare file
|
| 80 |
titles and file-link options (`thumb|250px|...`); captions stay ([v2#116](https://github.com/slayerlabs/polish-dynaword-v2/issues/116)).
|
| 81 |
+
It was applied to the committed text (`fetch_wikimedia.py retext`): 13,172 rows changed,
|
| 82 |
+
456,395 characters and 166,071 tokens removed, and 3 pages that fell under 200
|
| 83 |
characters were dropped (ids and titles in `wikivoyage.build.json`). Templates and comments are dropped; `<ref>`
|
| 84 |
bodies stay in the text (the wikipedia fetcher's `strip_article` removes them). Of two pages with the same text
|
| 85 |
(sha1 of the stripped text), the lower page id is kept.
|
|
|
|
| 89 |
## Statistics
|
| 90 |
| documents | characters | tokens (tiktoken proxy) |
|
| 91 |
|---:|---:|---:|
|
| 92 |
+
| 13,640 | 44,720,085 | 16,959,169 |
|
| 93 |
|
| 94 |
v0.2.5 had 13,645 documents, 45,184,300 characters and 17,128,200 tokens; the difference is the 2 pages withheld by the rights review and the residue cleanup (see Provenance).
|
| 95 |
|
|
|
|
| 118 |
`CC-BY-SA-3.0 AND CC-BY-SA-4.0`, with no threshold
|
| 119 |
- text moved or merged from an older page into a page created after the cutoff (labelled `CC-BY-SA-4.0` alone)
|
| 120 |
- the time of day of the switch (see Licensing)
|
| 121 |
+
- what `drop_residue` leaves: file-link options glued to the word before them (`Ladadikathumb|...`), category
|
| 122 |
+
links inside a line of prose, and `<ref>` bodies
|
| 123 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 124 |
- text first contributed under GFDL before the 2009 move to CC BY-SA, and GFDL dual
|
| 125 |
licensing; only the CC BY-SA grant is relied on
|
data/wikivoyage/wikivoyage.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:fdb4233d73af96b5370e46c8c56102081b38c388be03c58858baa149f8c3aeb7
|
| 3 |
+
size 19846184
|
data/wikivoyage/wikivoyage.stats.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
| 5 |
"drop_lang": 9,
|
| 6 |
"drop_dup": 0,
|
| 7 |
"drop_ocr": 0,
|
| 8 |
-
"chars":
|
| 9 |
-
"tokens":
|
| 10 |
"licenses": {
|
| 11 |
"CC-BY-SA-3.0": 11220,
|
| 12 |
"CC-BY-SA-3.0 AND CC-BY-SA-4.0": 1672,
|
|
|
|
| 5 |
"drop_lang": 9,
|
| 6 |
"drop_dup": 0,
|
| 7 |
"drop_ocr": 0,
|
| 8 |
+
"chars": 44720085,
|
| 9 |
+
"tokens": 16959169,
|
| 10 |
"licenses": {
|
| 11 |
"CC-BY-SA-3.0": 11220,
|
| 12 |
"CC-BY-SA-3.0 AND CC-BY-SA-4.0": 1672,
|
src/fetch_wikimedia.py
CHANGED
|
@@ -849,8 +849,8 @@ NOT_CHECKED_BY_CONTRIBUTION = {
|
|
| 849 |
`CC-BY-SA-3.0 AND CC-BY-SA-4.0`, with no threshold
|
| 850 |
- text moved or merged from an older page into a page created after the cutoff (labelled `CC-BY-SA-4.0` alone)
|
| 851 |
- the time of day of the switch (see Licensing)
|
| 852 |
-
- what `drop_residue` leaves: file-link options glued to the word before them (`Ladadikathumb|...`),
|
| 853 |
-
|
| 854 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 855 |
- text first contributed under GFDL before the 2009 move to CC BY-SA, and GFDL dual
|
| 856 |
licensing; only the CC BY-SA grant is relied on
|
|
|
|
| 849 |
`CC-BY-SA-3.0 AND CC-BY-SA-4.0`, with no threshold
|
| 850 |
- text moved or merged from an older page into a page created after the cutoff (labelled `CC-BY-SA-4.0` alone)
|
| 851 |
- the time of day of the switch (see Licensing)
|
| 852 |
+
- what `drop_residue` leaves: file-link options glued to the word before them (`Ladadikathumb|...`), category
|
| 853 |
+
links inside a line of prose, and `<ref>` bodies
|
| 854 |
- text imported from elsewhere under another licence or with extra attribution requirements
|
| 855 |
- text first contributed under GFDL before the 2009 move to CC BY-SA, and GFDL dual
|
| 856 |
licensing; only the CC BY-SA grant is relied on
|
src/test_wikivoyage_contract.py
CHANGED
|
@@ -13,15 +13,20 @@ WITHHELD = (2, 7820, 2960)
|
|
| 13 |
|
| 14 |
def test_wikivoyage_contract(tmp_path):
|
| 15 |
stats, ev = check_released("wikivoyage", tmp_path, dropped=WITHHELD)
|
| 16 |
-
assert (stats["kept"], stats["tokens"]) == (13640,
|
| 17 |
-
# v2#116: drop_residue changed 13,
|
| 18 |
build = json.loads((ROOT / "data" / "wikivoyage" / "wikivoyage.build.json").read_text(encoding="utf-8"))
|
| 19 |
clean = build["residue_cleanup"]
|
| 20 |
-
assert clean["rows_changed"] ==
|
| 21 |
assert [r["id"] for r in clean["dropped_short"]] == ["wikivoyage_11830", "wikivoyage_14345", "wikivoyage_15641"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# labelled by contribution (v2#110): 3.0, 4.0 or both
|
| 23 |
assert stats["licenses"] == {"CC-BY-SA-3.0": 11220, "CC-BY-SA-3.0 AND CC-BY-SA-4.0": 1672, "CC-BY-SA-4.0": 748}
|
| 24 |
-
assert ev["release_scope"]["tokens"] == {"CC-BY-SA-3.0":
|
| 25 |
labels = build["licence_labels"]
|
| 26 |
assert labels["cases"] == {"shipped_before_cutoff": 9039, "same_revision_text": 37, "identical_text": 1976,
|
| 27 |
"no_text_added": 168, "created_after_cutoff": 748, "changed_after_cutoff": 1672}
|
|
|
|
| 13 |
|
| 14 |
def test_wikivoyage_contract(tmp_path):
|
| 15 |
stats, ev = check_released("wikivoyage", tmp_path, dropped=WITHHELD)
|
| 16 |
+
assert (stats["kept"], stats["tokens"]) == (13640, 16959169)
|
| 17 |
+
# v2#116: drop_residue changed 13,172 rows; 3 pages fell under 200 characters
|
| 18 |
build = json.loads((ROOT / "data" / "wikivoyage" / "wikivoyage.build.json").read_text(encoding="utf-8"))
|
| 19 |
clean = build["residue_cleanup"]
|
| 20 |
+
assert clean["rows_changed"] == 13172 and clean["before"] == {"docs": 13643, "chars": 45176480, "tokens": 17125240}
|
| 21 |
assert [r["id"] for r in clean["dropped_short"]] == ["wikivoyage_11830", "wikivoyage_14345", "wikivoyage_15641"]
|
| 22 |
+
# the rows where the table-start fault fixed in Hub PR 127 had left a lone "{" of "{| class=..." are rebuilt
|
| 23 |
+
texts = dict(zip(*pq.read_table(ROOT / "data" / "wikivoyage" / "wikivoyage.parquet", columns=["id", "text"]).to_pydict().values()))
|
| 24 |
+
for i in (2055, 2564, 9129, 10490):
|
| 25 |
+
lines = texts[f"wikivoyage_{i}"].split("\n")
|
| 26 |
+
assert "{" not in lines and any(l.startswith("{| class=") for l in lines), i
|
| 27 |
# labelled by contribution (v2#110): 3.0, 4.0 or both
|
| 28 |
assert stats["licenses"] == {"CC-BY-SA-3.0": 11220, "CC-BY-SA-3.0 AND CC-BY-SA-4.0": 1672, "CC-BY-SA-4.0": 748}
|
| 29 |
+
assert ev["release_scope"]["tokens"] == {"CC-BY-SA-3.0": 6163588, "CC-BY-SA-3.0 AND CC-BY-SA-4.0": 9834703, "CC-BY-SA-4.0": 960878}
|
| 30 |
labels = build["licence_labels"]
|
| 31 |
assert labels["cases"] == {"shipped_before_cutoff": 9039, "same_revision_text": 37, "identical_text": 1976,
|
| 32 |
"no_text_added": 168, "created_after_cutoff": 748, "changed_after_cutoff": 1672}
|