Skip to content

Score joined initials the parse cuts at a full stop as agreeing - #1474

Merged
derek73 merged 1 commit into
masterfrom
claude/issue-1470-scorer-joined-initials-aae5d1
Nov 19, 2026
Merged

derek73 merged 1 commit into
masterfrom
claude/issue-1470-scorer-joined-initials-aae5d1

Conversation

@derek73

@derek73 derek73 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #1470

What was wrong, and since when

local_agreement.read compares ORCID's and PatentsView's given-names box with the parse's given and middle names joined by a space, and its fold cannot tell that space from one the filer typed. That held while the parser kept a joined run of initials as one word. 3.1.0's #1296 (rules/T7, the release log's "Change a given name written as a run of initials to read as the initials") began reading B.A.S.D. Kumarasiri as given B., middle A.S.D.; every release from 1.4.0 through 3.0.0 gave given B.A.S.D. (checked against the 1.4.0, 2.0.0, 2.3.0, 2.5.0, 2.8.2, 3.0.0 and 3.1.0 wheels). So the scorer was right until 3.1 and the parse change made it wrong: since then a box B.A.S.D. compared b asd with basd and scored a miss with the box's letters in the box's field.

The fix

agrees(box, got): the two agree where they fold alike, or where one writes as one word what the other cuts after one or more of its initials, an initial being a letter (with any combining marks) and a full stop (B.A.S.D. and B. A.S.D.; K.S and K. S; V.G.Ravi and V. G.Ravi). It stays a miss when:

  • the cut follows a word that is not initials (Md.Karim read Md. Karim, Jo.Ann, A.Bc.D.);
  • the run has no full stops (AB, MD, Al) or the reading lost one (K.S against K S);
  • a word is left over, at the end or in the middle, or the letters differ or are missing;
  • a title is peeled off the run (Dr.A.B.).

Both directions are checked (box joined, reading spaced, and the reverse). read() uses agrees for every box and for the suffix comparison. config_diff.py score reads through read(), so it gets the fix with no change of its own. cldr_agreement.py compares with its own same() (word multisets, full stops kept). Of the 4,992 field disagreements in the committed *_agreement*.json records, agrees would call none agreeing. So that comparison is left alone, and every committed record and the snapshot stay byte-identical.

Before and after

The same parser (this tree), with master's scorer and with this one, over every record of every fielded local corpus (2026-11-19):

corpus records disagree → agree agree → disagree
orcid-researchers 1,831,533 1,140 0
patentsview-inventors 657,991 35 0
psc-individuals 1,040,708 0 0
cz-candidates 170,181 0 0
uit-vinames 21,090 0 0
vn-assembly 499 0 0

Every moved record moved in the given+middle field alone. None still misses another field, no other field's reading changed, and no set-aside changed. One record (of the shape J.L. Pereira Junior) also now counts as agreeing by its suffix, as it should. The issue counted 1,104 records. Its per-country figures (Sri Lanka 403, Bangladesh 101, Netherlands 86) are reproduced exactly by the given boxes that open with letter-full stop-letter, which include an initial glued to a name (V.G.Ravi). The 1,140 here is that population: 865 boxes holding a word of initials only, and 275 holding initials glued to a name.

orcid-researchers moves per country: LK 403 (2.61 points of its 15,428), BD 101, NL 86, IN 55, RU 43, IQ 36, MY 25, HK 20, EG 20, BY 15. PatentsView: IN 8, TW 5, US 4, RU 4.

I read 50 drawn moves by hand (25 per corpus; seed in the measuring script). Each holds the box's letters, in order, in the given+middle field, cut only after initials, in shapes like G.A.S / Kumarasiri, Т.В. / Петренко, F.M.Rahman Karim, P.J.W. / Janssen. The examples in this description are invented names of the shapes read, not the holders' own.

One class to weigh: 24 of the 36 Iraqi moves are Arabic academic title abbreviations glued to the name (أ.د.سمير, أ.م.د.…, م.م.…). The parser leaves them in the given field and the holder typed them in the given box, so the box agrees. The same box written spaced (أ.د. سمير) agreed under the old scorer too, so this makes the scorer consistent rather than kinder. But these are titles the parser does not read, which is the issue's "second artifact" (a title in a box ORCID has no title box for).

Cut-only misses the fix leaves

After the fix, these records still differ from their box only by where a space falls:

  • 169 cuts after a word that is not initials: Md.Karim read Md. Karim, Moh.Rafi. That is 168 orcid-researchers records (146 Bangladesh, 8 Philippines) and 1 patentsview-inventors record. The task kept MD-like words out of the rule. These records are read right all the same, since both words land in the one box's field. Whether to widen the rule to any cut at a full stop the filer typed is a decision.
  • 20 orcid-researchers records (19 Korea): unspaced hangul segmented by rules/W1 in the given box, where the family box holds junk (\xad, .) or repeats the surname (김민준 / kim). These are the holder's error, not this artifact.
  • No other cut was found. No glued title or honorific peel, hyphen, Han segmentation or period_joined_vocab reading cut a written word across two scored fields in psc-individuals or cz-candidates, nor in the suffix comparison.

Lesson written down

  • A guard test: test_a_reading_cut_only_after_initials_is_never_scored_a_miss holds both halves over a grid of runs (Latin, Cyrillic, Devanagari; glued, spaced, alone; one- and two-word family). The 28 records whose reading holds the box's letters in the box's field never score a miss. The 28 read with a family word in the given field always do. Negative control: 22 misses with agrees replaced by the old fold comparison (_UNGUARDED_EFFECT).
  • tools/differential/README.md: the local_agreement paragraph says why the join breaks when a reading cuts a word, and what a parser change that cuts or joins a word reads first.
  • Root AGENTS.md: one sentence in the "Validating a new parsing rule" run that names local_agreement.py, for a reader changing the parser.

Shared agreement records

The scorer's fingerprint changes, so the shared agreement.jsonl records for every local source now refuse a run without --base until they are re-recorded. The issue asks for orcid-researchers and patentsview-inventors to be re-recorded. I left the shared files alone, as briefed; re-recording after merge is the coordinator's call. --base keys its kept records by the scorer too, so it is unaffected.

Checks

uv run pytest (50,450 passed), uv run pytest -n0 -m serial, uv run mypy and uv run ruff check all pass. Each new test row was run against master's scorer: the agreeing rows fail there, and the rows that must stay misses pass there.

Review

Reviewed with the pr-review-toolkit:

  • code-reviewer: nothing at confidence 80 or above.
  • pr-test-analyzer: led to the guard asserting both halves with exact counts, and to rows for a word left over in the middle, a word inside the run, digits (which killed a surviving isalpha mutation) and a glued title.
  • comment-analyzer: caught the first draft's AGENTS.md clause, which broke psc-individuals' description off its colon, and docstrings misdescribing the cut.
  • code-reviewer, second round: reviewed the review round's fix commit and found the moved AGENTS.md sentence splitting ORCID's description from its "Its name…" sentence. The sentence now stands before the local_agreement.py run. No other defect was found.

🤖 Generated with Claude Code

Since 3.1 (#1296, rules/T7) the parser reads a given-names box holding
`B.A.S.D.` as given `B.`, middle `A.S.D.`. local_agreement.read joins
the two with a space to compare them with the one box, and the fold
could not tell that space from one the filer typed, so the record
scored a miss with the box's letters in the box's field.

agrees() calls a box and a reading agreeing where they fold alike, or
where one writes as one word what the other cuts after one or more of
its initials (`B.A.S.D.` and `B.` `A.S.D.`, `V.G.Ravi` and `V.`
`G.Ravi`). A cut after a word that is not initials (`Md.Karim`), a
run without full stops, a word left over and other letters stay
misses. read() uses it for every box and for the suffix comparison,
and config_diff.py score reads through read().

Measured with the same parser, old scorer against new: 1,140
orcid-researchers and 35 patentsview-inventors records move from
disagreeing to agreeing, all in the given+middle field; no record
moves the other way and no other corpus moves. A guard test holds the
invariant over a grid both ways, with a recorded negative control.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73 derek73 added this to the 3.2 milestone Nov 19, 2026
@derek73 derek73 self-assigned this Nov 19, 2026
@derek73
derek73 merged commit 3dcf367 into master Nov 19, 2026
14 checks passed
@derek73
derek73 deleted the claude/issue-1470-scorer-joined-initials-aae5d1 branch November 19, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local_agreement scores joined initials read apart as a miss (B.A.S.D. beside Dayananda reads given B., middle A.S.D., scored wrong)

1 participant