Skip to content

Suggest two_family_names from a list's common surnames - #1499

Merged
derek73 merged 2 commits into
masterfrom
claude/issue-1452-two-family-names
Nov 20, 2026
Merged

derek73 merged 2 commits into
masterfrom
claude/issue-1452-two-family-names

Conversation

@derek73

@derek73 derek73 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Closes #1452

What changes

Parser.suggest can now suggest two_family_names (rules/O6, two family names: the word before the last joins the family).

  • One new signal, Signal.FIRST_SURNAME. It casts one vote a name, read from the parse itself:

    • Each name is parsed under the suggested reader with the switch off and with it on.
    • The vote looks at the word the switch would take into the family.
    • A common surname from COMMON_SURNAMES votes True (García in Gabriel García Márquez).
    • A father's name, a patronymic ending or marker, votes False. A name with one disagrees with a decided switch.
    • A common given name casts no vote (María in Ana María López).
  • When it is decided. Three conditions, all required:

    • at least 3 votes for it;
    • those votes are more than 30% of every name the switch would change (comma names and names joined with an interpunct count in that 30%);
    • more votes for it than against.
  • When it is not weighed. A note in the report says why. The switch is not weighed:

    • under a family-first order;
    • where the East Slavic rule is decided or on the base;
    • where the base already has the switch on.

    A group never turns the switch off.

  • The bare switch, never a pack. The docs say locales.ES, locales.PT_BR or locales.PT_PT reads a list better when its language is known.

  • Signal → setting table. _SETTING_OF is read by _order_ends, _checked_vote and _setting_of, and by _disagrees through _order_ends.

  • NameEvidence.votes may now hold True or False. _checked_vote refuses any other value for this signal.

  • Docs: Parser.suggest's docstring, docs/suggest.rst (a new "Lists that give two family names" section, with doctests), docs/getting-started.rst, docs/policy.rst, a decisions entry (decisions/group-suggestion, 2026-11-19 Should Parser.suggest propose two_family_names? A list of Gabriel García Márquez-style names gets no suggestion, and the default reads family Márquez #1452) with Standing and Open lines, one release-log bullet, AGENTS.md, and tools/differential/README.md.

  • tools/differential/suggest_measure.py gains:

    • the orcid-span-CC populations, ORCID holders per country, whose two boxes say which words are the family;
    • a two_family row per population;
    • whole names right under the suggestion against the base (whole) and under the bare switch (switch);
    • the parliaments' decided two_family_names.

The issue's questions

  • The two proposed signals.

    • (b), a listed surname, ships as FIRST_SURNAME.
    • (a), the shared second-to-last word, is dropped. A simulation put it beside (b). It decides Vietnamese lists in 99% of groups of 200 names, Pakistani in 88% of 500 and Bangladeshi in 100% of 2,000. Alone, (b) decides none at any size.
    • All (a) adds for the target lists is Brazilian and Portuguese lists, from 500 names. A guarded variant still decides Pakistani lists of 1,000 names in 92% of groups.
  • Must-not-move countries (BD, GH, KE, PK, VN, AO, MZ, TR): 0% of groups get the switch, at every size from 2 to 2,000 names, under either base.

  • Spanish-language lists. Lists written given first, under a given-first base:

    names 2 3 4 5 10 20 50 100 200 500+
    ES 0 1 3 8 45 75 90 99 99 100
    MX 0 3 15 25 77 98 100 100 100 100
    CO 0 7 19 33 84 96 99 100 100 100
    PE 0 6 14 31 76 87 98 99 100 100
  • AR, BR and PT.

    • Argentina belongs with the countries kept out. The switch costs its names 21 points on ORCID and 37 on PatentsView, and at most 7% of its groups get it (at 20 names).
    • Brazil and Portugal are not reached: at most two groups in 300 in any of their populations. The surname table holds few Portuguese surnames, and (a) reached them only by bringing Pakistan and Bangladesh with it. Even then the switch reads Brazil's ORCID holders better but its PatentsView inventors 24 points worse.
  • Whole names right, written given first under a given-first base. Suggestion against base, at 2 / 5 / 10 / 20 / 200 names:

    • ES 49 / 54 / 71 / 85 / 94% against 49 / 48 / 46 / 50 / 49%
    • MX 31 / 54 / 85 / 95 / 96% against 31 / 35 / 34 / 33 / 33%
    • CO 26 / 52 / 85 / 92 / 95% against 26 / 26 / 25 / 24 / 25%
    • PE 16 / 42 / 78 / 87 / 97% against 16 / 15 / 15 / 15 / 14%
    • Every other country is within half a point of master.
    • The bare switch over ORCID (config_diff.py score default --switches two_family_names) moves ES 49.6 → 94.8% and PE 14.7 → 97.3%. It moves BD 92.3 → 48.8% and MZ 85.4 → 50.4%; the decisions entry holds every country, ORCID and PatentsView.
  • Existing rows. Same-order rows, rows written against their base, and the east_slavic, letters and capitals rows are identical to master's, at both size sets. Parliaments: no list of the 28 decides the switch under any base, and nothing else in a list's suggestion moves.

  • Harness proof. With every vote count set out of reach, 138 rows read 0% and 138 read 100% over 69 populations. No group and no parliament decides two_family_names.

  • Base order × switches sweep. 9 made-up lists × 3 bases × 5 base switches: 36 of 135 cases move against master. Each is a Spanish list written given first that gets the switch.

    • With capitals_as_family or initials_as_family, the switch is suggested alongside, and each reads its own names.
    • With the East Slavic rule, decided or on the base, the switch is excluded.
    • Under a family-first order it is not weighed.
    • A base with the switch on gets nothing.
  • Left out of this version: Croatia, Slovenia, Iran, DR Congo and Cameroon. The bare switch reads their ORCID holders better and their PatentsView inventors a little worse, and nothing proposed here reaches them. middle_as_family and two_given_names as suggested settings are each a later issue (Open in the decisions entry).

Measured at seed 20261110, 300 groups a size, with the default sizes and --sizes 2,…,2000. Branch and master were compared on 667828a. After the rebase onto 34771e2, both were taken again at the default sizes. Outside two_family_names they are identical. Against the 667828a run, one decision cell moved, by one group in 300.

After master's #1497 was merged in (e0f698c), the default sizes were taken again: no decision cell moves, nor any must-not-move or same-order row. One count moves: whole names read right in orcid-span-PK, by 6 of 60,000 at 200 names and 1 of 15,000 at 50, alike under the base and the suggestion. That is #1497's parse change, and it moves no figure quoted here.

Pickle note

A NameEvidence or Suggestion holding Signal.FIRST_SURNAME does not unpickle under 3.1, which does not know the enum value. That is for the release's pickle-break bullet. A test holds that one round-trips under this release.

Cost

Where the switch is weighed, each name is parsed twice more. On a loaded machine, suggest took 0.65 s over 2,000 three-word names written given first, and 0.21 s over 2,000 two-word names; master takes 0.04 s for either. The docs advise a few hundred names, which take a tenth of that or less.

Checks

On the branch with master merged in (e0f698c), every check passes:

  • uv run pytest: 52,659 passed
  • uv run pytest -n0 -m serial: 38 passed
  • uv run mypy and uv run ruff check: clean
  • sphinx-build -b doctest docs: 1,432 tests, 0 failures
  • python -m doctest README.rst: passes

There are 53 new tests in tests/v2/test_suggest.py. Each fails on master or on the pre-fix code. A mutation that reads the base instead of the reader fails the three gate tests.

Review

These reviewers ran:

  • code-reviewer: three rounds, the last on the fix commit.
  • comment-analyzer, pr-test-analyzer and silent-failure-hunter, which covered the type questions: the bool vote and _checked_vote.
  • design-docs-reviewer: five rounds, every fix commit included.

The findings fixed:

  • the share's denominator, which left out comma and interpunct names;
  • the counts reported for an undecided setting, which were inverted;
  • a father's name, now a disagreeing vote;
  • the evidence rows' order, which depended on the input;
  • every figure quoted in the decisions entry, recomputed by the reviewers from the measurement records.

Not run:

  • type-design-analyzer: the one type change, a bool widening Vote, went to silent-failure-hunter.
  • code-simplifier: the release checklist's per-module simplify pass covers _suggest.py.

Follow-ups found in review, outside this change:

  • has_patronymic_ending matches surnames such as Rabinovich, so a name like Ana Rabinovich López votes against the switch, and now lists among the names disagreeing with it. This is the rule rules/O1 reads too.
  • initials_as_family's note names whichever of two tied runs comes first in the list (B K or K C). The setting decided is the same either way.

🤖 Generated with Claude Code

Parser.suggest now decides rules/O6's two_family_names. A new signal,
Signal.FIRST_SURNAME, reads each name under the suggested reader with
the switch off and on: a common surname (COMMON_SURNAMES) where the
switch would take a first surname votes True, a father's name there
votes False and disagrees with a decided switch, and a common given
name casts no vote. The switch is turned on, the bare switch and never
a pack, where at least three names, more than 30% of every name it
would change and more than the votes against carry the surname; it is
weighed only under a given-first order, with the East Slavic rule
neither decided nor on the base and the base's switch off, and a group
never turns it off. Each Signal member votes on one setting, named in
one table (_SETTING_OF) the deciding sites read.

The shared second-to-last word the issue also proposed is not built:
measured, it decides Vietnamese, Pakistani and Bangladeshi lists. No
must-not-move country (BD, GH, KE, PK, VN, AO, MZ, TR) gets the switch
at any size from 2 to 2,000 names; Spanish, Mexican, Colombian and
Peruvian lists get it from 10 to 20 names.

suggest_measure.py gains the orcid-span-CC populations and the
two_family, whole and switch rows; the docs, a decisions entry and a
release-log bullet record the measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 3.2 milestone Nov 20, 2026
@derek73 derek73 added name-order Name order, family-first and two family names (rules/O) suggester The group suggester: Parser.suggest() and its signals labels Nov 20, 2026
@derek73 derek73 self-assigned this Nov 20, 2026
Both conflicts were entries added at the same place, the release log's
bullet and the group-suggestion decisions entry; both sides kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit 0c4da6c into master Nov 20, 2026
14 checks passed
@derek73
derek73 deleted the claude/issue-1452-two-family-names branch November 20, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

name-order Name order, family-first and two family names (rules/O) suggester The group suggester: Parser.suggest() and its signals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should Parser.suggest propose two_family_names? A list of Gabriel García Márquez-style names gets no suggestion, and the default reads family Márquez

1 participant