Skip to content

Silence the surname vote where a name ends in a listed surname in two or three capitals (Zhou NG) - #1398

Merged
derek73 merged 4 commits into
masterfrom
fix/issue-1397-ending-short-capitals
Nov 15, 2026
Merged

derek73 merged 4 commits into
masterfrom
fix/issue-1397-ending-short-capitals

Conversation

@derek73

@derek73 derek73 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #1397

A capitals word of two or three letters ending a mixed-case name (Armitage JO, joined initials; Jason NG, a short surname) was not looked up as a surname, while the name's first word was. The group suggester's surname signal votes where exactly one end is listed, so it voted by the first word alone: Zhou NG cast a family-first vote wherever the given name is a listed surname too, and a given-first list of short capitals surnames moved a given-first base.

The rule

In a name holding a lowercase letter that ends in a capitals word of two or three letters, the surname signal casts no vote where that ending word is itself a listed surname; otherwise it votes by the word in front, as before; the ending word never votes alone. The capitals vote stays silent.

>>> Parser().suggest(["Yoon LI", "Zhou NG", "Yoon WU", "Zhou TAN", "Yoon MA", "Zhou HU"]).patch
PolicyPatch()        # was PolicyPatch(name_order=FAMILY_FIRST)

Implementation choices beside it:

  • The ending word is looked up in the suggester's romanized-surname table, under its spelling fold, only to veto. "The word in front" is the name's first word, the one the signal has always read beside the last.
  • With the veto in place, the old "not looked up" guard decides nothing: an unlisted ending word is no vote whether or not it is looked up. _at_one_end lost its skip_last parameter. A differential of the new _read against "master plus only the veto" over 680,943 generated names found 0 differences (code review).
  • The opening word's rule of Should Parser.suggest read AM Hoy as initials and a surname? A given-first byline list (AM Hoy, GH Yoon) is suggested FAMILY_FIRST #1355 is unchanged and silences the signal whatever ends the name (NG Zhou JO).
  • The release log gets the issue link on the Parser.suggest() bullet, suggest being new in 3.1.

Measured

uv run python tools/differential/suggest_measure.py --wrong-words 12 --base <an export of d516e89c>, 2026-11-14, 300 groups a size, seed 20261110. Share of groups suggested right at 2 / 3 / 4 / 5 / 10 / 20 / 50 / 200 names. These are all six order rows that moved.

population written base before after
orcid-famcaps-short (the anti-goal row of #1397) given-first given-first 97.0 / 96.0 / 93.0 / 89.7 / 79.3 / 83.0 / 94.3 / 100 100 at every size
orcid-famcaps-short given-first family-first 2.0 / 2.3 / 11.3 / 11.3 / 18.3 / 17.0 / 10.3 / 1.3 2.0 / 3.7 / 14.0 / 16.7 / 43.0 / 75.3 / 97.3 / 100
orcid-famcaps-ea given-first given-first 99.0 / 99.3 / 98.7 / 99.0 / 99.7 / 100 … 100 at every size
orcid-famcaps-ea given-first family-first 23.0 / 41.7 / 58.3 / 65.3 / 85.7 / 91.7 / 99.3 / 100 23.0 / 47.7 / 64.7 / 79.7 / 98.3 / 100 / 100 / 100
orcid-famcaps given-first family-first 84.0 / 94.3 / 98.7 / 99.7 / 100 … 84.0 / 97.0 / 99.0 / 100 / 100 …
orcid-givcaps (fails by design) family-first family-first 48.3 / 26.0 / 8.7 / 7.3 / 0.3 … 48.3 / 24.7 / 7.7 / 6.0 / 0.3 …
  • No byline cell moved: orcid-byline and orcid-byline-joined are identical in both written orders under both bases, and so are their per-name and per-signal counts (orcid-byline written family-first: surname 76 right, 5 wrong, before and after).
  • No cell outside the ORCID capitals populations moved. No capitals_as_family decision moved; the TURKIC table and every parliament list are identical.
  • Per name, written given-first (right / wrong / contested / none, then the surname signal's right and wrong):
    • orcid-famcaps-short (3,000): 485 / 445 / 1 / 2,069, surname 0 and 440 → 485 / 37 / 1 / 2,477, surname 0 and 32.
    • orcid-famcaps-ea (1,411): 683 / 122 / 6 / 600, surname 460 and 128 → 683 / 12 / 6 / 710, surname 460 and 18.
    • orcid-famcaps (3,000): surname 143 and 57 → 143 and 20.
  • Harness proof (--set _MIN_VOTES=1000000 --set _MIN_PATRONYMIC_VOTES=1000000 --set _MIN_RUN_NAMES=1000000): 0% on all 58 rows written against their base, 100% on all 58 written in it.

orcid-famcaps-short's row holds 100% at every size, so it is off the tool's list of anti-goal exceptions (the tool's docstring, AGENTS.md, tools/differential/README.md). orcid-byline-joined's given-first row at 50 and 200 names and orcid-givcaps' two rows stay on it, unchanged.

Accepted costs, recorded in decisions/group-suggestion (2026-11-14 #1397)

  • The wrong votes the veto cannot see stay: a given name that is a listed surname before a short capitals surname the table does not list. 32 of 3,000 in orcid-famcaps-short (440 before), 12 of 1,411 in orcid-famcaps-ea; that population's other 6 wrong surname votes (18 in all, 128 before) are on names that do not end in a short capitals word, which the rule never read.
  • A byline written family first whose initials spell a listed surname loses its family-first vote (Kim JO). None of the pooled bylines' right votes was one.
  • A short-surname-only list written given-first still takes 50 names to move a family-first base (97% at 50, 75% at 20), and small East Asian family-in-capitals groups stay weak there (23 / 48 / 65 / 80% at 2 to 5 names).
  • orcid-byline-joined's given-first row stays under 95% at 50 and 200 names.
  • Found by the design-docs review and accepted the same day, beside those four: a name written family first whose given name is two or three capitals that spell a listed surname loses the right vote its family name cast. 33 of orcid-givcaps' 132 right surname votes written family-first, 2 of vi's 2,102; it moves one row in three cells, orcid-givcaps family-first under a family-first base at 3, 4 and 5 names, above.

Declined, with recipes in the entry

Each is an edit to the silent test in _suggest._read, run with --tree <copy>; each re-run from this tree gave the same cells as the measurement made before the change was written.

  • Every name ending in a short capitals word casts no surname vote. Same fix, but it takes the family-first bylines' votes: orcid-byline-joined written family-first under a given-first base 0.3 / 2.3 / 3.7 / 5.3 / 16.0 / 37.0 / 77.7 / 99.0 → 0 / 0 / 0 / 0 / 0.7 / 1.7 / 10.3 / 26.0, and its same-order row falls to 93.0% at 200 names.
  • The ending word looked up as any word. Largest gains under a family-first base, but initials that spell a surname then vote given-first (Marsh JO): orcid-byline-joined's same-order row falls to 98.7 / 97.0 / 94.3 / 93.7 / 80.3 / 66.7 / 72.3 / 76.7.
  • The first variant for two-word names only. The first variant's byline costs, and less of the fix (147 wrong votes left of 440).

Tests

  • tests/v2/test_suggest.py: the ending word listed or not, the first word listed or not, both; two and three letters, four unchanged; three-word names; a capitals word before the ending word; post-nominals with and without a comma, a title, a family comma; the spelling fold; a joiner in the ending word; a short capitals word at both ends (the Should Parser.suggest read AM Hoy as initials and a surname? A given-first byline list (AM Hoy, GH Yoon) is suggested FAMILY_FIRST #1355 rule); lists under each name_order base, one of them with a vetoed name among names that vote.
  • 17 of the new rows fail on master (d516e89's module swapped in).
  • Mutants of the silent clause, run against the final tests, each caught: master's rule (the veto gone, the old guard kept) fails 17 rows; the clause dropped (the ending word votes alone) fails 10; firing on every name ending in short capitals fails 10; asking the first word instead of the last fails 20. Restoring the old guard beside the veto passes every test, as it must: it changes no reading.

Checks

uv run pytest (48,594 passed), uv run pytest -n0 -m serial, uv run mypy, uv run ruff check, sphinx-build -b doctest and -b html, python -m doctest README.rst, and the suite once on 3.15 in its own environment (the serial run and the 3.15 run on the first commit; the second changes prose and test rows, and the full parallel suite, mypy, ruff and both docs builds were re-run on it). Every measurement ran with a private NAMEPARSER_TOOLS_CACHE. Every example name this PR adds was checked against the ORCID corpus.

Reviews run on the first commit, findings fixed in the second: design-docs review (every recomputed figure reproduced; the unrecorded cost above, missing head notes on two older entries, two wording points) and code review (no defect; one test row filed under the wrong test, missing edge rows). The second commit was reviewed independently by the coordinating session (code and design docs: no defect, every figure and all three Declined recipes reproduced); its six prose findings are the third commit, 1f32df3.

Unrelated, not fixed: the HTML build warns that docs/migrate.rst:1338 references the label customize-md-title with no title, since #1395.

🤖 Generated with Claude Code

derek73 and others added 2 commits November 14, 2026 19:56
… or three capitals

A capitals word of two or three letters ending a mixed-case name was
not looked up as a surname while the word in front of it was, so the
group suggester's surname signal voted by the word in front alone:
`Zhou NG` cast a family-first vote wherever the given name is a listed
surname too, and a given-first list of short capitals surnames moved a
given-first base. The ending word is now looked up, only to veto: where
it is itself a listed surname the name casts no surname vote; otherwise
the word in front votes as before, and the ending word never votes
alone. The capitals vote stays silent.

suggest_measure.py: orcid-famcaps-short written given-first keeps a
given-first base in 100% of groups at every size (97 / 96 / 93 / 90 /
79 / 83 / 94 / 100% before), and no byline cell or vote moves.
decisions/group-suggestion's 2026-11-14 #1397 entry holds the re-taken
table, the accepted costs and the three variants declined.

Closes #1397

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…r the reviews of #1397

The design-docs review found a cost the run shows and the entry did not
record: a name written family first whose given name is two or three
capitals that spell a listed surname loses its family name's right vote
(33 of orcid-givcaps' 132 written family-first, 2 of vi's 2,102). It is
recorded beside the four accepted costs. The entries that stated the
superseded "no surname lookup" carry head notes, "the word in front" is
said to be the name's first word, and the declined variants' recipes
name their code. The code review found no defect; a row filed under the
wrong test is moved, and rows are added for a three-word name, the
spelling fold, a joiner in the ending word and a vetoed name among
names that vote.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@derek73 derek73 added this to the 3.1 milestone Nov 15, 2026
@derek73 derek73 added bug suggester The group suggester: Parser.suggest() and its signals labels Nov 15, 2026
@derek73 derek73 self-assigned this Nov 15, 2026
derek73 and others added 2 commits November 14, 2026 20:36
… with their recipes

The cost the design-docs review found is not yet accepted, so it leaves
the Accepted list for a bullet of its own that says so, and its moved
row is given as three cells. The wrong votes the veto leaves in
orcid-famcaps-ea are 12 on names of the class it reads and 6 on names
it never read, with the count's recipe. The ORCID shape snapshot states
the definition its digits come from. Guide and reference say the first
word is usually the given name there and the table cannot tell the
readings apart. The tools README dates its proof count and drops an
undated percentage; the Declined recipes say what --tree takes and that
the edit replaces the whole statement.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The cost the design-docs review found (a family-first name whose given
name is two or three capitals that spell a listed surname loses its
family name's right vote) is accepted, so it joins the Accepted list as
its fifth item, its finding in review kept as history.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@derek73
derek73 merged commit 8f4b77b into master Nov 15, 2026
14 checks passed
@derek73
derek73 deleted the fix/issue-1397-ending-short-capitals branch November 15, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug suggester The group suggester: Parser.suggest() and its signals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should a name ending in a short capitals word cast a surname vote in Parser.suggest? Zhi LI votes family-first, by Zhi

1 participant