ppuzio Claude Opus 5.5 commited on
Commit
d6bd578
·
1 Parent(s): c2099e6

Drop partner republications from global_voices (2,040 -> 1,926)

Browse files

Global Voices republished posts from partner outlets (PRI/The World,
The Stand News, HKFP, Agencia Publica, Meta.mk, 350.org and 45 others)
under content-sharing agreements or with permission. Their text is the
partner's work, not covered by Global Voices' CC BY 3.0 grant.

src/clean_global_voices.py matches the republication note in a post's
opening 700 / closing 350 characters (8 rules, 25 hand-checked keeps,
3 listed drops), filters the SHA-256-pinned v0.2.5 parquet and sidecar,
and rewrites stats.json. 114 documents, 261,102 tokens dropped.
Contract test: src/test_global_voices_contract.py.

Refs slayerlabs/polish-dynaword-v2#50

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

artifacts/source_findings.md CHANGED
@@ -1321,3 +1321,78 @@ https://www.gov.pl/web/gov/prawa-autorskie (read 2026-10-06).
1321
 
1322
  **Lesson** — an open-licence footer covers the publisher's own text. On a news-style
1323
  site, check source lines for agency copy before taking the footer at face value.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1321
 
1322
  **Lesson** — an open-licence footer covers the publisher's own text. On a news-style
1323
  site, check source lines for agency copy before taking the footer at face value.
1324
+
1325
+ ## global_voices — partner republications dropped (2026-10-06)
1326
+
1327
+ **Verdict** — `admitted` with 114 posts withheld (polish-dynaword-v2 #50). The source
1328
+ goes from 2,040 docs / 10,073,628 chars / 3,715,020 tokens to 1,926 / 9,358,071 /
1329
+ 3,453,918. The posts come from 51 outlets. The new `src/clean_global_voices.py` filters
1330
+ the v0.2.5 Parquet and sidecar, pinned by SHA-256. `src/test_global_voices_contract.py`
1331
+ checks that no shipped row matches the rule.
1332
+
1333
+ **Reason** — Global Voices licenses "content created by Global Voices" under CC BY 3.0.
1334
+ A post that republishes a partner's article under a content-sharing agreement or with
1335
+ permission stays the partner's work.
1336
+ - **Where the rule looks.** It reads only the first 700 and last 350 characters, where
1337
+ the editorial note sits. A rule fires only on a sentence about the post itself that
1338
+ does not name Global Voices, so news reporting ("raport opublikowany przez UNESCO")
1339
+ and GV's own projects do not count. Sentences whose subject is an image are skipped
1340
+ too.
1341
+ - **Rule counts** (a post can match several):
1342
+ - originally: 69
1343
+ - agreement: 56
1344
+ - published_by: 51
1345
+ - partnership: 11
1346
+ - permission: 5
1347
+ - republished: 5
1348
+ - written_for: 3
1349
+ - non_commercial: 3
1350
+ - listed by hand: 3 (21466, 27005, 32352)
1351
+ - **Hand check.**
1352
+ - Every one of the 114 drops was read, and the English original was consulted where
1353
+ the note was unclear.
1354
+ - 25 rule matches are kept by hand with a stated reason:
1355
+ - 12 cross-posts from the author's own blog;
1356
+ - 7 posts GV wrote for the ISN blog;
1357
+ - 3210, a GV post that another outlet republished;
1358
+ - 2 notes dating GV's own English original;
1359
+ - 3 news mentions.
1360
+ - All 43 posts where the gating removed a raw match were checked. They are image
1361
+ credits, news and GV projects.
1362
+ - 15 partner-organisation accounts with no republication note (e.g. 350.org 22567,
1363
+ Metamorphosis 33071) were checked against the English page and kept.
1364
+ - **Outlets.**
1365
+ - PRI/The World 21
1366
+ - The Stand News 8
1367
+ - Hong Kong Free Press 7
1368
+ - Agência Pública 6
1369
+ - Metamorphosis/Meta.mk 5
1370
+ - 350.org 5
1371
+ - Eurasianet 3
1372
+ - Freemuse 3
1373
+ - The Irrawaddy 3
1374
+ - 2 each: Balkan Diskurs, Ensia, Kurtural, Loa, MigraMundo, NACLA, Nepali
1375
+ Times/Himalkhabar, Premium Times, Syria Untold, Teplitsa, Transitions
1376
+ - 1 each: 88 Bar, APC.org, Afroféminas, Azerbaijan Internet Watch, Baynana, Bumaga,
1377
+ CHRI, Cari-Bois, Chaikhana, Common Dreams, Connectas, Doha News, Fundación MEPI,
1378
+ GCHR, Hive-Mind/EJO, Iran Voices, New America Media, OC Media, Periodismo de
1379
+ Barrio, Promundo, Russia Post, Sin Embargo, Syria Deeply, TJournal, Tea After
1380
+ Twelve, The Isaan Record, The Moscow Times, VideoVolunteers, WITNESS,
1381
+ inmediahk.net, openDemocracy.
1382
+ - **Delta against the audit's 64.** The audit used outlet names plus an agreement
1383
+ regex, and it recorded neither the list nor the script. Its "17 PRI" is an
1384
+ undercount: all 21 posts credited to PRI/PRX's The World carry a republication note.
1385
+ Most of the remaining difference is outlets the audit's name list did not cover,
1386
+ such as The Stand News (8) and Agência Pública (6). The Hub PR has per-document
1387
+ evidence.
1388
+ - **Borderline; dropped and flagged for review.**
1389
+ - Freemuse ×3: the note allows republication "by non-commercial media" only.
1390
+ - Bumaga 30003: a shorter version of the author's article for Bumaga.
1391
+ - Hive-Mind/EJO 34820.
1392
+ - openDemocracy 29544: "under a Creative Commons licence", version not stated.
1393
+ - Transitions 34277: "powstał dzięki umowie partnerskiej", possibly a co-production.
1394
+ - 32352: built on two Meta.mk texts.
1395
+
1396
+ **Lesson** — the licence covers what the publisher created. A per-post editorial note
1397
+ is the only signal of a partner's work, so the filter has to read the note and not only
1398
+ the byline.
data/global_voices/NOTICE.md CHANGED
@@ -6,6 +6,8 @@ original authors and translators under Creative Commons Attribution 3.0.
6
  Source: https://pl.globalvoices.org/
7
  License: https://creativecommons.org/licenses/by/3.0/
8
 
9
- Per-record contributor attribution is stored in the `author` column. The accompanying `global_voices.attribution.jsonl` sidecar additionally preserves each released article's title, canonical URL, license URL and modification notice. Twelve historical records had no machine-readable contributor field; full-text review recovered Didem Tali and Khalid Ibrahim for two of them. Ten records without an identifiable contributor use the explicitly organizational attribution `Global Voices`; this must not be interpreted as a known individual author.
 
 
10
 
11
  Binary media files are not included. Articles may nevertheless contain captions, URLs, social-media posts and quotations from third-party works; rights in those materials may remain with their respective authors. Article-level CC BY 3.0 is not asserted independently for photographs, videos, embeds or separately quoted works.
 
6
  Source: https://pl.globalvoices.org/
7
  License: https://creativecommons.org/licenses/by/3.0/
8
 
9
+ Per-record contributor attribution is stored in the `author` column. The accompanying `global_voices.attribution.jsonl` sidecar additionally preserves each released article's title, canonical URL, license URL and modification notice. Eleven released records had no machine-readable contributor field; full-text review recovered Khalid Ibrahim for one of them. Ten records without an identifiable contributor use the explicitly organizational attribution `Global Voices`; this must not be interpreted as a known individual author.
10
+
11
+ Posts that Global Voices republished from partner outlets (for example PRI's The World, Hong Kong Free Press, The Stand News, Meta.mk and 350.org) are not included. Their text remains the partner's work, and the Global Voices CC BY 3.0 grant does not demonstrably cover it.
12
 
13
  Binary media files are not included. Articles may nevertheless contain captions, URLs, social-media posts and quotations from third-party works; rights in those materials may remain with their respective authors. Article-level CC BY 3.0 is not asserted independently for photographs, videos, embeds or separately quoted works.
data/global_voices/global_voices.attribution.jsonl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ab8ad393c4453524c4f3d7fe89157bfca1d9f66f2a735815f3b1ebd405c8fa13
3
- size 1146354
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4709fcc9a53bb5d7d1a90eb29d2b6e8f398c28bfb842f9be0710353e9a4e691
3
+ size 1078938
data/global_voices/global_voices.md CHANGED
@@ -17,7 +17,7 @@ Global Voices describes its Lingua translations as human-made work performed by
17
 
18
  | documents | characters | tokens (`cl100k_base` proxy) |
19
  |---:|---:|---:|
20
- | 2,040 | 10,073,628 | 3,715,020 |
21
 
22
  The Parquet schema matches DynaWord:
23
 
@@ -34,7 +34,7 @@ Published files:
34
 
35
  Articles were acquired directly from the Polish Global Voices website through its official publication interfaces, rather than from a third-party corpus. Each released ID is linked to the corresponding canonical article URL in `global_voices.attribution.jsonl`.
36
 
37
- The source release contained 2,044 records. Four records below the minimum quality and length requirements were excluded, leaving 2,040 documents. The final source contains no exact duplicate documents.
38
 
39
  ## Cleaning
40
 
@@ -46,7 +46,19 @@ The cleaning process did not use machine translation or automatic speech transcr
46
 
47
  CC BY 3.0 was verified from the article-level license link published with each retained Global Voices article. Each released record carries `CC-BY-3.0` metadata. Contributor roles are preserved in the `author` column where available, distinguishing original authors from Polish translators.
48
 
49
- Because the fixed DynaWord schema does not contain article titles or URLs, the attribution sidecar maps every released `id` to its title, canonical URL, contributor attribution, license URL and modification notice. It contains one unique URL-bearing record for each of the 2,040 Parquet documents.
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  Recommended attribution:
52
 
 
17
 
18
  | documents | characters | tokens (`cl100k_base` proxy) |
19
  |---:|---:|---:|
20
+ | 1,926 | 9,358,071 | 3,453,918 |
21
 
22
  The Parquet schema matches DynaWord:
23
 
 
34
 
35
  Articles were acquired directly from the Polish Global Voices website through its official publication interfaces, rather than from a third-party corpus. Each released ID is linked to the corresponding canonical article URL in `global_voices.attribution.jsonl`.
36
 
37
+ The source release contained 2,044 records. Four records below the minimum quality and length requirements were excluded, leaving 2,040 documents. A later rights review excluded 114 posts that Global Voices republished from partner outlets (see below), leaving 1,926 documents. The final source contains no exact duplicate documents.
38
 
39
  ## Cleaning
40
 
 
46
 
47
  CC BY 3.0 was verified from the article-level license link published with each retained Global Voices article. Each released record carries `CC-BY-3.0` metadata. Contributor roles are preserved in the `author` column where available, distinguishing original authors from Polish translators.
48
 
49
+ Because the fixed DynaWord schema does not contain article titles or URLs, the attribution sidecar maps every released `id` to its title, canonical URL, contributor attribution, license URL and modification notice. It contains one unique URL-bearing record for each of the 1,926 Parquet documents.
50
+
51
+ ### Partner republications (excluded)
52
+
53
+ Global Voices licenses the content it creates under CC BY 3.0. Some posts instead republish an article that a partner outlet published first, under a content-sharing agreement or with the outlet's permission. That text remains the partner's work, so the release excludes it. `src/clean_global_voices.py` finds the editorial note such posts carry in their opening or closing lines (for example "pierwotnie ukazał się na portalu PRI.org … w ramach umowy o wymianie treści"). It also excludes three posts whose note the rules miss and keeps 25 look-alike notes, each with a stated reason. Every match was checked by hand.
54
+
55
+ The rule excluded 114 posts from 51 outlets. The largest groups are PRI/The World (21), The Stand News (8), Hong Kong Free Press (7), Agência Pública (6), Metamorphosis/Meta.mk (5) and 350.org (5). Three Freemuse co-commissions are excluded because their note allows republication only by non-commercial media.
56
+
57
+ The following posts are kept:
58
+ - posts that Global Voices contributors cross-posted from their own blogs;
59
+ - posts Global Voices wrote for the ISN blog;
60
+ - posts that partner organisations wrote directly for Global Voices without a republication note;
61
+ - photo-only permission credits.
62
 
63
  Recommended attribution:
64
 
data/global_voices/global_voices.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1ca02fdb6bad32b20757ddcd9b9f072056ff35b68c487143138cc7912b3a45c3
3
- size 5253559
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cd33133703e9ea375060cf2f83c2aec915d9786db5fd7d4b34fc2f3643c9c7ba
3
+ size 4907377
data/global_voices/global_voices.stats.json CHANGED
@@ -1,15 +1,34 @@
1
  {
2
  "read": 2044,
3
- "kept": 2040,
4
  "drop_short": 4,
5
  "drop_lang": 0,
6
  "drop_dup": 0,
7
  "drop_ocr": 0,
8
- "chars": 10073628,
9
- "tokens": 3715020,
 
10
  "licenses": {
11
- "CC-BY-3.0": 2040
12
  },
13
- "authors_with_value": 2040,
14
- "stats_recomputed_from_parquet": true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
 
1
  {
2
  "read": 2044,
3
+ "kept": 1926,
4
  "drop_short": 4,
5
  "drop_lang": 0,
6
  "drop_dup": 0,
7
  "drop_ocr": 0,
8
+ "drop_partner_republication": 114,
9
+ "chars": 9358071,
10
+ "tokens": 3453918,
11
  "licenses": {
12
+ "CC-BY-3.0": 1926
13
  },
14
+ "authors_with_value": 1926,
15
+ "stats_recomputed_from_parquet": true,
16
+ "partner_republication": {
17
+ "by_rule": {
18
+ "agreement": 56,
19
+ "non_commercial": 3,
20
+ "originally": 69,
21
+ "partnership": 11,
22
+ "permission": 5,
23
+ "published_by": 51,
24
+ "republished": 5,
25
+ "written_for": 3
26
+ },
27
+ "listed": 3,
28
+ "kept_by_hand": 25
29
+ },
30
+ "input_sha256": {
31
+ "global_voices.parquet": "1ca02fdb6bad32b20757ddcd9b9f072056ff35b68c487143138cc7912b3a45c3",
32
+ "global_voices.attribution.jsonl": "ab8ad393c4453524c4f3d7fe89157bfca1d9f66f2a735815f3b1ebd405c8fa13"
33
+ }
34
  }
src/clean_global_voices.py ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Drop Global Voices posts republished from partner outlets (slayerlabs/polish-dynaword-v2#50).
3
+
4
+ Global Voices licenses "content created by Global Voices" under CC BY 3.0. Posts it republished
5
+ from partner outlets (PRI's The World, Hong Kong Free Press, The Stand News, Meta.mk, 350.org,
6
+ The Irrawaddy, ...) under content-sharing agreements or with permission stay the partner's work,
7
+ so the CC BY grant does not demonstrably cover them. Each such post carries an editorial note in
8
+ its first or last lines, e.g. "Ten artykuł ... pierwotnie ukazał się na portalu PRI.org ... i jest
9
+ publikowany ponownie w ramach umowy o wymianie treści". `note_rules()` finds those notes.
10
+
11
+ Kept on purpose: posts that GV contributors cross-posted from their own blogs, posts GV wrote for
12
+ the ISN partnership, partner organisations writing directly for GV with no republication note,
13
+ and photo-only permission credits ("Zdjęcie ..., użyte za pozwoleniem").
14
+
15
+ The input is the Parquet and sidecar as of v0.2.5 (the Parquet is unchanged since), pinned by
16
+ SHA-256. Restore them before a rerun:
17
+ git checkout 92b36dc -- data/global_voices/global_voices.parquet data/global_voices/global_voices.attribution.jsonl
18
+ python3 src/clean_global_voices.py
19
+ """
20
+ from __future__ import annotations
21
+
22
+ import argparse
23
+ import hashlib
24
+ import json
25
+ import os
26
+ import re
27
+ from collections import Counter
28
+ from pathlib import Path
29
+
30
+ import pyarrow.parquet as pq
31
+
32
+ SOURCE = "global_voices"
33
+ ROOT = Path(__file__).resolve().parents[1]
34
+ DATA = ROOT / "data" / SOURCE
35
+ INPUT_SHA256 = {
36
+ f"{SOURCE}.parquet": "1ca02fdb6bad32b20757ddcd9b9f072056ff35b68c487143138cc7912b3a45c3",
37
+ f"{SOURCE}.attribution.jsonl": "ab8ad393c4453524c4f3d7fe89157bfca1d9f66f2a735815f3b1ebd405c8fa13",
38
+ }
39
+
40
+ # The contributed release (PR #7) read 2,044 records and dropped 4 short ones before the v0.2.5 input.
41
+ READ, DROP_SHORT = 2044, 4
42
+ # Editorial notes sit in the lede or the closing lines; the body quotes and reports on
43
+ # agreements, first publications and permissions far too often to search it.
44
+ HEAD, TAIL = 700, 350
45
+ # Sentence ends before an upper-case start or at a paragraph break, so "umowy dot. współdzielenia" holds.
46
+ SENTENCE = re.compile(r"(?<=[.!?])\s+(?=[^\sa-ząćęłńóśźż])|\s*\n+\s*")
47
+ PUB = r"(?:opublik|publik|ukaza|ukazuj|pojawi|przedruk|zamieszcz|udostępni|reprodukow|wydan)\w*"
48
+ FIRST = r"(?:pierwotnie|oryginalnie|orginalnie|po\s+raz\s+pierwszy|pierwszy\s+raz|początkowo|uprzednio|wcześniej|najpierw|w\s+oryginale)"
49
+ NOT_GV = r"(?!Global\s*Voices|GV\b|globalvoices|ramach|naszym|niniejszym|tym\b)"
50
+ # A note speaks about the post itself: "Ten artykuł ...", "Poniżej publikujemy zredagowaną wersję artykułu ...",
51
+ # "Jest to trzecia odsłona historii ...", "Opublikowano za zgodą PRI".
52
+ SELF = re.compile(
53
+ r"^\W*(?:\S+\s+){0,2}?(?:artykuł|tekst|post|wpis|histori|reportaż|wywiad|wiadomoś|wersj|seri|częś|materiał|opowieś|esej|treś)\w{0,3}\b"
54
+ rf"|^\W*(?:Jest|Są)\s+to\b|^\W*(?:\S+\s+)?{PUB}", re.I)
55
+ GV = re.compile(r"\bGV\b|Global\s*Voices|Rising\s*Voices", re.I)
56
+ # Photo, art and video credits ("Zdjęcie: ... Opublikowano za zgodą.") are not text republications;
57
+ # their sentences do not open with a text noun, and a bare permission line right after one belongs to it.
58
+ IMAGE = r"zdj[eę]ci|zdjęć|fotograf|\bfot\.|ilustracj|obraz|grafik|wideo|\bfilm|nagrani|plakat|rysun|karykatur|okład|zrzut|\bmap"
59
+ CREDIT = re.compile(rf"^\W*(?:\S+\s+)?\S*?(?:{IMAGE})", re.I) # an image is the subject
60
+
61
+ RULES = {
62
+ # "w ramach umowy o wymianie treści", "na mocy porozumienia o dzieleniu się treściami",
63
+ # "umowy partnerskiej", "porozumienie z Global Voices"
64
+ "agreement": re.compile(
65
+ r"\b(?:umow|porozumie)\w*\s+(?:\w+\s+){0,3}?(?:o\s+|dot\.\s*|dotycząc\w*\s+|w\s+sprawie\s+)?"
66
+ r"(?:wymian|udostępn|dzieleni|współdziel|podzia|rozpowszechn|partnersk|partnerstw)\w*"
67
+ r"|\bporozumieni\w*\s+z\s+Global\s+Voices", re.I),
68
+ # "w ramach partnerstwa pomiędzy PRI i Global Voices", "w ramach naszej współpracy z Syria Deeply",
69
+ # "post partnerski ze strony EurasiaNet.org"
70
+ "partnership": re.compile(
71
+ r"(?:w\s+ramach|na\s+mocy|na\s+podstawie|jako\s+część)\s+(?:\w+\s+){0,2}?(?:partnerstw|współprac)\w*\s+"
72
+ r"(?:\w+\s+){0,3}?(?:z|pomiędzy|między)\s"
73
+ r"|\bpost\w*\s+partnersk\w*|\bpartnersk\w*\s+post\w*", re.I),
74
+ # "pierwotnie ukazał się na portalu PRI.org", "pojawił się po raz pierwszy na stronie CHRI",
75
+ # "Oryginalny tekst [ru] dostępny na stronie Teplicy"
76
+ "originally": re.compile(
77
+ rf"{FIRST}\s+(?:\S+\s+){{0,6}}?(?:{PUB}|ujrzał\w*)|{PUB}\s+(?:\S+\s+){{0,2}}?{FIRST}"
78
+ r"|oryginaln\w*\s+(?:\[\w+\]\s+)?(?:wersj|tekst|artykuł|publikacj)\w*", re.I),
79
+ # "Ta republikacja", "jest tutaj reprodukowany", "poniższa reedycja"
80
+ "republished": re.compile(r"\brepublikacj\w*|reprodukowan\w*|przedrukowan\w*|reedycj\w*", re.I),
81
+ # "napisany przez Fentona Lutunatabua dla 350.org", "artykułu napisanego przez Irinę Illa Pueyo dla Afroféminas"
82
+ "written_for": re.compile(rf"napisan\w*\s+(?:\S+\s+){{0,6}}?dla\s+{NOT_GV}", re.I),
83
+ # "Artykuł został opublikowany na stronie internetowej Agência Pública", "część artykułu opublikowanego na łamach The Stand News"
84
+ "published_by": re.compile(
85
+ rf"(?:artykuł|tekst|post|wpis|histori|reportaż|wywiad|wiadomoś|wersj|seri)\w*\s+(?:\S+\s+){{0,8}}?"
86
+ rf"(?:opublikowan|publikowan|ukazał|pojawił)\w*\s+(?:\S+\s+){{0,3}}?"
87
+ rf"(?:na\s+stronie|na\s+łamach|na\s+portalu|w\s+serwisie|na\s+blogu|przez|w)\s+{NOT_GV}", re.I),
88
+ # "Opublikowano za zgodą PRI", "Opublikowany za pozwoleniem." (the author's or artist's own consent is not a partner's)
89
+ "permission": re.compile(
90
+ rf"{PUB}\s+(?:\S+\s+){{0,6}}?(?:za|ze|z)\s+(?:\S+\s+)?(?:zgodą|pozwoleniem|przyzwoleniem)(?!\s+(?:autor|artyst))", re.I),
91
+ # Freemuse co-commissions: "may be republished by non-commercial media" conflicts with CC BY
92
+ "non_commercial": re.compile(r"niekomercyjn\w*\s+medi|non-commercial\s+media", re.I),
93
+ }
94
+ # Rules that fire only on a sentence about the post itself that does not name Global Voices,
95
+ # so news reporting ("raport opublikowany przez UNESCO") and GV's own projects do not count.
96
+ SELF_RULES = {"originally", "republished", "written_for", "published_by", "permission"}
97
+
98
+ # Notes a rule matches that are not partner republications, checked by hand against the text
99
+ # and, where unclear, the English original on globalvoices.org.
100
+ OWN_BLOG = "the GV author's cross-post from their own blog"
101
+ ISN = "written by GV for the ISN blog under the GV-ISN partnership"
102
+ KEEP = {
103
+ **{f"global_voices_{n}": OWN_BLOG + " (Juan Arellano, Globalizado)"
104
+ for n in (7749, 11971, 18309, 20340, 21612, 22399, 25101)},
105
+ "global_voices_1420": OWN_BLOG + " (Georgia Popplewell, Caribbean Free Radio)",
106
+ "global_voices_23554": OWN_BLOG + " (Elia Ayoub, Hummus For Thought)",
107
+ "global_voices_28150": OWN_BLOG + " (Jillian C. York)",
108
+ "global_voices_28814": OWN_BLOG + " (Anca Matioc, Medium)",
109
+ "global_voices_29905": OWN_BLOG + " (Derek Lackaff, r12n)",
110
+ **{f"global_voices_{n}": ISN for n in (13370, 14712, 14881, 14946, 15662, 17435, 18724)},
111
+ "global_voices_3210": "a GV post that Ezhednevny Zhurnal republished, not the reverse",
112
+ "global_voices_15986": "dates GV's own English original",
113
+ "global_voices_22228": "dates GV's own English original",
114
+ "global_voices_8": "news about an AOL partnership deal",
115
+ "global_voices_14503": "news: a quoted blogger's posts also ran in The Guardian",
116
+ "global_voices_15837": "news: interviews published on the Mujeres Mundi blog",
117
+ }
118
+ # Partner republications whose note no rule matches.
119
+ DROP = {
120
+ "global_voices_21466": "Agência Pública; a long quoted title splits the note",
121
+ "global_voices_27005": "inmediahk.net; the note follows a 1,000-character lede",
122
+ "global_voices_32352": "based on two Meta.mk / CriThink.mk (Metamorphosis Foundation) texts",
123
+ }
124
+
125
+
126
+ def sha256(path: Path) -> str:
127
+ digest = hashlib.sha256()
128
+ with path.open("rb") as stream:
129
+ for chunk in iter(lambda: stream.read(1 << 20), b""):
130
+ digest.update(chunk)
131
+ return digest.hexdigest()
132
+
133
+
134
+ def note_zone(text: str) -> str:
135
+ return text if len(text) <= HEAD + TAIL else text[:HEAD] + "\n" + text[-TAIL:]
136
+
137
+
138
+ def note_rules(text: str) -> list[str]:
139
+ """Names of the rules whose pattern matches a sentence in the post's opening or closing lines."""
140
+ hits = []
141
+ previous = ""
142
+ for sentence in SENTENCE.split(note_zone(text)):
143
+ about_post = SELF.search(sentence) and not GV.search(sentence) and not CREDIT.search(sentence)
144
+ for name, rule in RULES.items():
145
+ if name in hits or (name in SELF_RULES and not about_post):
146
+ continue
147
+ if name == "permission" and re.search(IMAGE, previous, re.I):
148
+ continue
149
+ if rule.search(sentence):
150
+ hits.append(name)
151
+ previous = sentence
152
+ return hits
153
+
154
+
155
+ def reason(doc_id: str, text: str) -> str | None:
156
+ """Why a row is dropped (rule names, or the DROP note), or None to keep it."""
157
+ if doc_id in DROP:
158
+ return "listed: " + DROP[doc_id]
159
+ if doc_id in KEEP:
160
+ return None
161
+ hits = note_rules(text)
162
+ return "+".join(hits) if hits else None
163
+
164
+
165
+
166
+ def build(input_dir: Path, out_dir: Path) -> dict:
167
+ parquet, sidecar = (input_dir / name for name in INPUT_SHA256)
168
+ for path, expected in zip((parquet, sidecar), INPUT_SHA256.values()):
169
+ if sha256(path) != expected:
170
+ raise SystemExit(f"{path} is not the v0.2.5 input; restore it with the command in this script's docstring")
171
+ table = pq.read_table(parquet)
172
+ lines = sidecar.read_text(encoding="utf-8").splitlines(keepends=True)
173
+ ids = table.column("id").to_pylist()
174
+ sidecar_ids = [json.loads(line)["id"] for line in lines]
175
+ if len(set(ids)) != len(ids) or set(ids) != set(sidecar_ids) or len(sidecar_ids) != len(ids):
176
+ raise SystemExit("Parquet and attribution sidecar do not cover the same ids")
177
+ if stale := (KEEP.keys() | DROP.keys()) - set(ids):
178
+ raise SystemExit(f"KEEP/DROP name ids that are not in the input: {sorted(stale)}")
179
+
180
+ rows = table.to_pylist()
181
+ dropped = {row["id"]: why for row in rows if (why := reason(row["id"], row["text"]))}
182
+ kept = [row for row in rows if row["id"] not in dropped]
183
+ rules = Counter(name for why in dropped.values() if not why.startswith("listed: ") for name in why.split("+"))
184
+ stats = {
185
+ "read": READ, "kept": len(kept),
186
+ "drop_short": DROP_SHORT, "drop_lang": 0, "drop_dup": 0, "drop_ocr": 0,
187
+ "drop_partner_republication": len(dropped),
188
+ "chars": sum(len(r["text"]) for r in kept), "tokens": sum(r["token_count"] for r in kept),
189
+ "licenses": dict(Counter(r["license"] for r in kept)), "authors_with_value": sum(bool(r["author"]) for r in kept),
190
+ "stats_recomputed_from_parquet": True,
191
+ "partner_republication": {
192
+ "by_rule": dict(sorted(rules.items())),
193
+ "listed": sum(why.startswith("listed: ") for why in dropped.values()),
194
+ "kept_by_hand": len(KEEP),
195
+ },
196
+ "input_sha256": INPUT_SHA256,
197
+ }
198
+ staged = {
199
+ out_dir / f"{SOURCE}.parquet.tmp": lambda p: pq.write_table(
200
+ table.from_pylist(kept, schema=table.schema), p, compression="zstd"),
201
+ out_dir / f"{SOURCE}.attribution.jsonl.tmp": lambda p: p.write_text(
202
+ "".join(line for line, i in zip(lines, sidecar_ids) if i not in dropped), encoding="utf-8"),
203
+ out_dir / f"{SOURCE}.stats.json.tmp": lambda p: p.write_text(
204
+ json.dumps(stats, indent=2, ensure_ascii=False) + "\n", encoding="utf-8"),
205
+ }
206
+ for path, write in staged.items():
207
+ write(path)
208
+ for path in staged:
209
+ os.replace(path, path.with_suffix(""))
210
+ return {**stats, "dropped": dropped}
211
+
212
+
213
+ def main() -> None:
214
+ parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
215
+ parser.add_argument("--input", type=Path, default=DATA, help="directory holding the v0.2.5 Parquet and sidecar")
216
+ parser.add_argument("--out", type=Path, default=DATA)
217
+ args = parser.parse_args()
218
+ print(json.dumps(build(args.input, args.out), indent=2, ensure_ascii=False))
219
+
220
+
221
+ if __name__ == "__main__":
222
+ main()
src/sources.py CHANGED
@@ -720,9 +720,10 @@ SOURCES = {
720
  "global_voices": {
721
  "added": "2026-07-15",
722
  "release": "0.2.3",
723
- # Data contributed directly (PR #7): no in-repo fetch/build script and a
724
- # hand-authored datasheet. Registered for the source table + release totals;
725
- # the datasheet stays contributor-owned via custom_datasheet.
 
726
  "file_key": "global_voices",
727
  "pretty": "Global Voices Polish",
728
  "license": "CC-BY-3.0",
@@ -731,6 +732,17 @@ SOURCES = {
731
  "with each retained Global Voices article; each record carries "
732
  "CC-BY-3.0 metadata and per-document author/translator attribution "
733
  "in global_voices.attribution.jsonl.",
 
 
 
 
 
 
 
 
 
 
 
734
  "upstream": "https://pl.globalvoices.org/",
735
  "domain": "civic media, news and public-interest journalism",
736
  "created": "2008-11-04, 2023-05-24",
 
720
  "global_voices": {
721
  "added": "2026-07-15",
722
  "release": "0.2.3",
723
+ # Data contributed directly (PR #7) with a hand-authored datasheet; no fetch
724
+ # script. src/clean_global_voices.py drops partner republications from it.
725
+ # Registered for the source table + release totals; the datasheet stays
726
+ # contributor-owned via custom_datasheet.
727
  "file_key": "global_voices",
728
  "pretty": "Global Voices Polish",
729
  "license": "CC-BY-3.0",
 
732
  "with each retained Global Voices article; each record carries "
733
  "CC-BY-3.0 metadata and per-document author/translator attribution "
734
  "in global_voices.attribution.jsonl.",
735
+ "provenance": "Contributed directly (PR #7) from pl.globalvoices.org. "
736
+ "src/clean_global_voices.py filters the v0.2.5 Parquet and "
737
+ "attribution sidecar (pinned by SHA-256) to drop partner "
738
+ "republications: 2,040 -> 1,926 documents.",
739
+ "legal_note": "Posts Global Voices republished from partner outlets are dropped "
740
+ "(114 posts from 51 outlets, among them PRI's The World, The Stand "
741
+ "News, Hong Kong Free Press, Agência Pública, Meta.mk and 350.org). "
742
+ "Their text is the partner's work, not content created by Global "
743
+ "Voices under its CC BY 3.0 grant. The rule matches the "
744
+ "republication note in a post's opening or closing lines; posts "
745
+ "contributors cross-posted from their own blogs are kept.",
746
  "upstream": "https://pl.globalvoices.org/",
747
  "domain": "civic media, news and public-interest journalism",
748
  "created": "2008-11-04, 2023-05-24",
src/test_global_voices_contract.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Contract checks for the partner-republication drop in global_voices (src/clean_global_voices.py)."""
2
+
3
+ import json
4
+ from pathlib import Path
5
+
6
+ import pyarrow.parquet as pq
7
+
8
+ from clean_global_voices import DROP, KEEP, note_rules, reason
9
+
10
+ DATA = Path(__file__).resolve().parents[1] / "data" / "global_voices"
11
+ KEPT = 1926 # 2,040 in v0.2.5 minus 114 partner republications
12
+
13
+
14
+ def test_release_has_no_partner_republications():
15
+ stats = json.loads((DATA / "global_voices.stats.json").read_text(encoding="utf-8"))
16
+ table = pq.read_table(DATA / "global_voices.parquet")
17
+ rows = table.to_pylist()
18
+ sidecar = [json.loads(line) for line in (DATA / "global_voices.attribution.jsonl").read_text(encoding="utf-8").splitlines()]
19
+ ids = [r["id"] for r in rows]
20
+ assert table.column_names == ["id", "text", "source", "added", "created", "token_count", "license", "author"]
21
+ assert table.num_rows == stats["kept"] == len(sidecar) == KEPT
22
+ assert stats["read"] == stats["kept"] + stats["drop_short"] + stats["drop_partner_republication"]
23
+ assert stats["chars"] == sum(len(r["text"]) for r in rows)
24
+ assert stats["tokens"] == sum(r["token_count"] for r in rows)
25
+ assert len(set(ids)) == len(ids)
26
+ assert {a["id"] for a in sidecar} == set(ids)
27
+ assert {r["source"] for r in rows} == {"global_voices"}
28
+ assert {r["license"] for r in rows} == {a["license"] for a in sidecar} == {"CC-BY-3.0"}
29
+ assert [i for i, r in zip(ids, rows) if reason(i, r["text"])] == []
30
+ assert not DROP.keys() & set(ids)
31
+ # Every hand exception is still in the release and still needed (a rule matches it).
32
+ texts = dict(zip(ids, (r["text"] for r in rows)))
33
+ assert [i for i in KEEP if not note_rules(texts[i])] == []
34
+
35
+
36
+ def test_note_rules():
37
+ pri = "Ten artykuł autorstwa Jane Doe pierwotnie ukazał się na portalu PRI.org 5 maja 2015 r. i jest publikowany ponownie w ramach umowy o wymianie treści."
38
+ assert note_rules(pri) == ["agreement", "originally", "published_by"]
39
+ assert note_rules("Opublikowano za zgodą PRI.") == ["permission"]
40
+ assert note_rules("Artykuł, napisany przez Giorgiego Lomsadze, jest również dostępny na stronie EurasiaNet.org. Opublikowany za pozwoleniem.") == ["permission"]
41
+ assert note_rules("Ten artykuł został napisany przez Hodę Baraka dla 350.org, organizacji tworzącej ruch na rzecz klimatu.") == ["written_for"]
42
+ assert note_rules("Jest to już trzecia odsłona historii, która pierwotnie została opublikowana w języku chińskim na stronie The Stand News.") == ["originally"]
43
+ assert note_rules("Poniżej publikujemy zredagowaną wersję artykułu, który pojawił się po raz pierwszy na stronie Centrum Praw Człowieka w Iranie.") == ["originally"]
44
+ # Notes are searched only in the opening and closing lines.
45
+ assert note_rules("x " * 1000 + "\nTen artykuł pierwotnie ukazał się na PRI.org.") == ["originally"]
46
+ assert note_rules("x " * 400 + "\nTen artykuł pierwotnie ukazał się na PRI.org.\n" + "y " * 400) == []
47
+ # Photo credits, the author's own consent, news reporting, GV's own projects and look-alike words.
48
+ for text in (
49
+ "Więzienie w Monte Cristo. Zdjęcie: Luiz Silveira, Agence CNJ. Opublikowano za zgodą.",
50
+ "Zdjęcie opublikowane za zgodą Tunisia Live",
51
+ "Ilustracja opublikowana pierwotnie w magazynie Puck 25 stycznia 1899 roku.",
52
+ "Sami Shah. Opublikowane za zgodą autora.",
53
+ "Według raportu opublikowanego przez Amnesty International, 13 tys. osób zginęło.",
54
+ "Artykuł ten został napisany i opublikowany przez Rezwana w ramach projektu Rising Voices",
55
+ "Inicjatywa I Can Help U podsumowuje to wszystko udostępniając zdjęcie poniżej:",
56
+ "Dekret ogranicza naukę rdzennych języków w republikach narodowych Federacji Rosyjskiej.",
57
+ "Tunezyjski blog Nawaat, we współpracy z Ministerstwem Młodzieży, rozpoczął nowy projekt.",
58
+ ):
59
+ assert note_rules(text) == [], text
60
+
61
+
62
+ def test_reason_lists():
63
+ own_blog = "Ten post był pierwotnie opublikowany na blogu Juana Arellano Globalizado [es]."
64
+ assert reason("global_voices_0", own_blog) == "originally+published_by"
65
+ assert reason("global_voices_7749", own_blog) is None
66
+ assert reason("global_voices_32352", "").startswith("listed: ")
67
+ assert reason("global_voices_0", "Zwykły tekst bez noty.") is None