Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions tests/v2/test_local_corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -3595,15 +3595,15 @@ def test_no_module_imports_a_sibling_constant() -> None:
# module. A `from local_x import CONSTANT` would bind a second name a
# patch on local_x cannot reach, and a test could pass with its guard
# off. The modules are SOURCES' own, so a new source is covered. PSC,
# JRC, ORCID, PV, VOLBY, DOF, UIT, VN, PARLIAMENTS, MY, CTGOV_OFFICIALS and
# CTGOV_CONTACTS are sources' names, keys of
# JRC, ORCID, PV, VOLBY, DOF, UIT, VN, PARLIAMENTS, MY, PMC_AUTHORS,
# PMC_CITATIONS, CTGOV_OFFICIALS and CTGOV_CONTACTS are sources' names, keys of
# SOURCES, and no fetch's setting; split is a function, not a setting.
import ast
sources = {source.fetch.__module__ for source in local.SOURCES.values()}
assert sources == {m.__name__ for m in (ctgov, fec, tse, tw, ukec, psc, jrc, nepal, orcid,
patentsview, volby, dof, uit, vnassembly,
parliaments, mycandidates)
} | {"local_govuk"}
} | {"local_govuk", "local_pmc"}
siblings = {"local_corpora", "local_core", *sources}
imported = {(path.stem, alias.name)
for path in (Path(str(local.__file__)).parent / f"{s}.py"
Expand All @@ -3616,6 +3616,8 @@ def test_no_module_imports_a_sibling_constant() -> None:
("local_corpora", "VOLBY"), ("local_corpora", "DOF"),
("local_corpora", "UIT"), ("local_corpora", "VN"),
("local_corpora", "PARLIAMENTS"), ("local_corpora", "MY"),
("local_corpora", "PMC_AUTHORS"),
("local_corpora", "PMC_CITATIONS"),
("local_corpora", "CTGOV_OFFICIALS"),
("local_corpora", "CTGOV_CONTACTS")}

Expand Down
493 changes: 493 additions & 0 deletions tests/v2/test_local_pmc.py

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions tools/differential/README.md

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions tools/differential/local_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
and `vn-assembly` state a name whole, in the Vietnamese order, and their
parts are derived by the convention a reader of the name assumes, first
word the family name and last the given (local_uit.split), with
`vn-assembly`'s title composed from the education its deputies state). What
`vn-assembly`'s title composed from the education its deputies state;
and the two PubMed Central corpora, whose parts the articles' JATS
markup tags: `pmc-authors`' prefix, given names, surname and suffix with
the degrees, the name composed from them, and `pmc-citations`' given
names, surname and suffix, whose display name is not the boxes joined
but the citation's text as written). What
cldr_agreement.py does for the committed fields files, over names that
are never committed -- so no CI run and no reviewer sees this score,
and its record lives in the cache beside the corpus, where a re-run
Expand All @@ -39,7 +44,8 @@
default's record and a pack's never stand for each other.

The report prints counts and shapes, never a record: agreement overall
and by the group a source states (a nationality, a country), the misses per field,
and by the group a source states (a nationality, a country, a journal,
the order a cited name was written in), the misses per field,
the commonest disagreement shapes, a shape being each disagreeing
field's word count as filed and as parsed (`middle 0->1, family 2->1` is
a two-word surname whose first word was read as a middle name), and the
Expand All @@ -54,7 +60,8 @@

- Each field is compared case-folded, with periods dropped, commas read
as spaces and runs of spaces read as one. The display name is the
boxes joined, so the parser sees the filer's own spelling, and the
boxes joined (`pmc-citations`' is the citation's own text, which the
boxes were tagged in), so the parser sees the filer's own spelling, and the
fold only keeps a box's case, periods, commas or spacing from reading
as a miss: a suffix typed into the surname box after a comma
(`Smith, Jr.`) is the parser's family and suffix rejoined. A word
Expand All @@ -68,7 +75,8 @@
`OBE`) stood last in the display name, so it was typed into the last
filled box, normally the surname: the parser's family is compared
with its suffix appended, and the report counts the agreements that
needed it. Where it has one (`cz-candidates`' title after the name),
needed it. Where it has one (`cz-candidates`' title after the name,
the PMC corpora's suffix, `pmc-authors`' holding the degrees too),
the suffix is compared with that box alone.
- Where a source has a title box, a filed title the parser does not read as the title, holding a word
the vocabulary lists in neither its titles nor its connectives, is
Expand Down Expand Up @@ -187,7 +195,13 @@ def __post_init__(self) -> None:
{"family": "family", "middle": "middle", "given": "given"}, group="gender"),
local_corpora.VN: Fielded(
{"title": "title", "family": "family", "middle": "middle", "given": "given"},
group="ethnicity", group_cased=True, sets_aside=False, group_floor=10)}
group="ethnicity", group_cased=True, sets_aside=False, group_floor=10),
local_corpora.PMC_AUTHORS: Fielded(
{"prefix": "title", "given": "given+middle", "family": "family",
"suffix": "suffix"}, group="journal", group_cased=True, group_floor=100),
local_corpora.PMC_CITATIONS: Fielded(
{"given": "given+middle", "family": "family", "suffix": "suffix"},
group="order", group_cased=True, group_floor=100)}
#: The fewest records sharing a set-aside title for the report to print
#: it: a word typed into the title box by this many filers is no one
#: person's name.
Expand Down
25 changes: 21 additions & 4 deletions tools/differential/local_corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@
national parliament, with the member, its script, the dataset and
whether it is the name or an alias; one distinct spelling of a
Malaysian election candidate within an election, with the election,
the form (ballot or full name) and the ethnicity. The counts are
counted from here.
the form (ballot or full name) and the ethnicity; one distinct
composed name and boxes of a PMC article's contributor, with the
first article holding it, its journal and licence; one distinct
spelling and boxes of a name tagged in the text of a PMC article's
reference, with the order written and the same three. The counts
are counted from here.
- corpus.jsonl -- the distinct names, in the corpus line format
snapshot.py and compare.py --corpus read: each record's "name", and
for nepal-candidates its Devanagari name too, and for
Expand Down Expand Up @@ -103,8 +107,9 @@
(orcid-researchers), local_patentsview.py (patentsview-inventors),
local_volby.py (cz-candidates), local_dof.py (dof-signatures),
local_uit.py (uit-vinames), local_vnassembly.py (vn-assembly),
local_parliaments.py (opensanctions-parliaments) and
local_mycandidates.py (my-candidates).
local_parliaments.py (opensanctions-parliaments),
local_mycandidates.py (my-candidates) and local_pmc.py (pmc-authors,
pmc-citations).
"""
from __future__ import annotations

Expand Down Expand Up @@ -156,6 +161,8 @@
from local_parliaments import PARLIAMENTS, check_parliaments, fetch_parliaments # noqa: E402
from local_patentsview import (PV, check_pv, extract_path as pv_extract, # noqa: E402
fetch_pv, pv_boxes, renew_pv)
from local_pmc import (PMC_AUTHORS, PMC_CITATIONS, check_pmc, # noqa: E402
fetch_authors, fetch_citations)
from local_psc import PSC, check_psc, fetch_psc, renew_psc # noqa: E402
from local_tse import check_tse, fetch_tse # noqa: E402
from local_tw import fetch_tw # noqa: E402
Expand Down Expand Up @@ -322,6 +329,16 @@ def index(self) -> WordIndex:
"elections, from Thevesh Theva's analysis-election-msia "
"(github.com/Thevesh/analysis-election-msia, GPL-3.0)",
unit="spellings", fetch=fetch_my, check=check_my, group="ethnicity"),
PMC_AUTHORS: Source(
credit="PubMed Central (NIH/NLM) Article Datasets, a sample of articles' "
"contributors (each article under its own licence; each name "
"composed from the tagged parts, so derived data)",
unit="names", fetch=fetch_authors, check=check_pmc),
PMC_CITATIONS: Source(
credit="PubMed Central (NIH/NLM) Article Datasets, a sample of articles' "
"cited names as their reference lists write them (each article "
"under its own licence)",
unit="spellings", fetch=fetch_citations, check=check_pmc),
}


Expand Down
Loading