Skip to content

Divide a family of two surnames by its own words, behind a comma too (#1456, #1479) - #1485

Merged
derek73 merged 5 commits into
masterfrom
claude/issue-1456-1479-surname-views-96f3a0
Nov 19, 2026
Merged

derek73 merged 5 commits into
masterfrom
claude/issue-1456-1479-surname-views-96f3a0

Conversation

@derek73

@derek73 derek73 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #1456
Closes #1479

Under Policy.two_family_names, the surname1/surname2 views now divide a family of two surnames however the family was read. The switch is on in locales.ES, ES_AR, CS, SK, PT_BR and PT_PT. Covered: before a family comma, a family that opens with a particle, and a family behind a given name a particle completes (rules/P10). No field moves, and nothing moves with the switch off.

                                  master                       this branch
García Márquez, Juan              García Márquez | ''          García | Márquez
Juan de la Vega Ruiz              de la Vega Ruiz | ''         de la Vega | Ruiz
de la Vega Ruiz, Juan             de la Vega Ruiz | ''         de la Vega | Ruiz
María del Carmen García López     García López | ''            García | López
Juan de la Vega Ruiz Soto         whole                        whole (three units)
Ortega y Gasset, José             whole                        whole (open, decisions/R10)
García-López, Ana                 whole                        whole (one hyphenated word; open)

The design: one division, one place

_post_rules._divide_family is the one place O6 (two family names) divides a family. It runs:

  • after O6 takes a word into the family, where the two units used to be marked directly;
  • for a family O6 takes nothing into: one that already holds two words (a P2 particle chain, or the family a P10 phrase leaves), or one that O9's capitals named;
  • through _divide_comma_family, for the part before a family comma. That part must hold the family's words alone (none joined from after the comma by P1's fold or P6's attachment), and its script must set no order other than the declared one (W4).

How the units are counted. They are P1's fold units over the family in written order (unit_ends(chain=False)): a particle run with the one name word it attaches to, a bound given-name word with the word it completes, or a plain word. Exactly two get marked.

What stays whole:

A particle P6 attached at the end goes with the first unit. The view code is unchanged.

Why P10's family was never divided (#1479's fourth question): it was a consequence, not a decision. P2's chain del Carmen García López made the family; P10 moved del Carmen out, leaving a family of two words. O6 counted two, took nothing, and so marked nothing. rules/P10's Accepted clause recorded that result, and no decisions entry gave a reason to want it.

The particle-led rule, and what it gets wrong

Rule: the particles and the one word they attach to, then the next word. This is the cut rules/O6 and P1 already make under a family-first order.

Measured before choosing. I used Spanish-speaking ORCID holders: 276,027 records in 20 countries with both boxes filled, under parser_for(locales.ES). #1479's counts reproduce to within 4: P10 3,204 against 3,200, particle-led two-word 1,756 exactly, three or four words 37 against 36.

What the hand-read found. I read 250 random records of the 1,756 by hand. None is one surname of three words; every one is a particle surname plus a second surname (de la Cruz 171, de León 120, da Silva 54). The vocabulary chains santa and san, so Santa Cruz and San Martín stay one unit. A compound place surname such as de la Torre Ugarte reads de la Torre | Ugarte; that is the one thing the rule gets wrong (rules/R10 Accepted), and none appeared in the sample.

#1479's four questions:

  1. Multi-word surnames behind a particle: 0 of the 250 sampled.
  2. Three name words behind a particle: 37 records, left whole.
  3. Family-first orders: they cut as given-first does; the grid below holds them.
  4. P10: a defect (see above). It goes from 3,204 undivided to 7, and those 7 have three name words.

Measured

The tree against master, 296,151 names. That is every committed corpus name, every cases.py text, and the Spanish-speaking ORCID names and credit names. I parsed them under 13 configurations: the default, plus the bare switch, locales.ES, the switch with capitals_as_family, and the switch with middle_as_family, each in all three orders.

No field, ambiguity report or str() moved in any configuration, and nothing moved under the default. The views moved:

locales.ES moved P10 particle-led family comma emptied (below)
given-first 6,672 3,270 2,312 1,028 62
FAMILY_FIRST 1,117 – 6 1,018 93
FAMILY_FIRST_GIVEN_LAST 1,116 – 6 1,017 93

The Portuguese packs (after rebasing onto #1481). I compared against d12af9d6, under PT_BR and PT_PT, over the committed names plus the ORCID names of PT, BR, AO, MZ and CV. No field moved. The views moved for 9,553 names under each pack:

  • 4,917 particle-led (A. Manuel de Oliveira Duarte → de Oliveira | Duarte);
  • 3,464 behind a P10 phrase or a chain;
  • 1,097 before a comma;
  • 75 emptied.

ORCID, Spanish-speaking holders, locales.ES:

  • divided families: 166,695 → 171,654;
  • P10 shape: 3,204 → 7;
  • particle-led with two name words: 1,756 → 0;
  • credit names with one comma whose two-word head is the holder's family box: 566 of 625 now divide, 0 before.

Of those 59, the parser does not read the comma as a family comma in some (González Ruiz, MA reads MA as a credential), and the head is one unit in the others (Dos Santos, Priscila).

Seven ORCID families with a hyphen now divide, because a hyphenated word beside a plain word is a unit of its own, as the take always counted it (Sánchez-Cid Torres). One of them is cut where its writer probably meant two hyphen-joined surnames: De la cruz-La rosa. A one-word hyphenated family (García-López) stays whole.

Other checks:

  • local_agreement.py orcid-researchers --base (default parser): matches the base, 1,831,533 records.
  • cldr_agreement.py: every default view matches. Under the ES pack, two CLDR sorting renderings now agree (von Miller Jones, Prof. Dr. Mary Sue Marie, Pablo Pérez, Sr. Miguel Ángel Juan Antonio), and the record was re-recorded.
  • test_snapshot.py: the snapshot parses the default policy, so it cannot see these views. It shows only the new rule-example names, now recorded. I measured the views directly, as above.

Frames (sys.setprofile calls, warm parse, py3.11). The default is unchanged (reference row 196, Smith, John 98, Gabriel García Márquez 159), so _CALL_BASELINE's band holds. Under locales.ES:

name master branch
Gabriel García Márquez 198 202
García Márquez, Gabriel 165 175
Juan de la Vega Ruiz 176 187
María del Carmen García López 256 264
Smith, John 99 100

The comma path's W4 check is a C-level test, max(text) >= "Ѐ", because every keyed script is written from U+0400 up. That saves the script walk on accented Latin.

Tests

  • test_both_writings_of_one_family_read_the_same_units holds the principle. For every head whose family is the same in both writings, X Y, Given and the comma-less writing give the same views. The grid:

    • heads: plain, particle-led, particle inside, saint particle, hyphen, connective, three words, initial, shared name, listed given name, bound given-name pairs (عبد الله حسن, Abu Bakr Siddiq, abdul Rahman Khan), bin Abd Rahman, one word;
    • given names: plain, two words, behind a title, P10;
    • spellings: as written, capitals, NFD;
    • configurations: bare switch and locales.ES, in all three orders.

    1,659 same-family pairs, and 0 disagree. The recorded negative control (comma division off) gives 1,241; master gives 941.

  • test_each_head_divides_as_recorded_in_both_writings pins each head's units.

  • _COMMA_HEAD_ROWS pins the comma path's refusals, which the grid cannot see because their two writings read different families:

    • words joined from after the comma;
    • W4 for Han and Hangul, both ways;
    • an empty script_orders;
    • a keyed Cyrillic order (locales.MN) and an unkeyed one;
    • the interpunct;
    • particle-only units;
    • a two-word unit;
    • title, dual, suffix and title-particle heads;
    • CS.

    Every one of the six mutations the test review found surviving now fails a row (I ran each).

  • Case rows: Case gains an optional views, asserted by test_case. I ran the new rows on master: the 8 new-behavior rows fail there, and the 3 left-whole rows pass.

  • test_types.py's view rows: values changed, and a '' row is kept for every shape still refused.

Moves the issues did not ask for

Every path now goes through the one function. As a result, a family the take built that does not count as two units reads whole. Under locales.ES, that is 62 names given-first and 93 under each family-first order. Every one was a wrong division on master:

  • a lone particle as the first unit under a family-first order (Del Piero Ortega, Van Gogh Ana María). rules/O6 and R11 had accepted this as an error; their Accepted clauses are reworded or deleted;
  • a lone connective taken as a unit (Carod i Rovira);
  • a bound given-name word with the unit it completes, family-first (Abd El Kader Haddou);
  • the Turkic five-word name (Ali Ahmad Vali Hasan oglu with the Turkic rule): Hasan oglu is now one unit, as O2's three-word reading is.

Two moves go the other way, from whole to divided:

  • a bound pair now counts as one word in a comma head (abdul Rahman Khan, Ali → abdul Rahman | Khan);
  • the given-first Abd El Kader Haddou now reads El Kader | Haddou.

All of these are recorded in decisions/O6's entry, items 8–10.

Decided (2026-11-19, recorded on #1456 and in decisions/O6 and O9)

  1. The capitals family is divided too under capitals_as_family + two_family_names (Ana GARCÍA LÓPEZ → GARCÍA | LÓPEZ), given names O9 misreads as the family included (536 names beyond the bare switch's moves). Kept.
  2. The moves the issues did not ask for (above) are accepted.
  3. A lone particle ending a family stays the second unit (Beethoven van, Ludwig, Juan García de).
  4. The connective and the one-word hyphen stay open in decisions/R10.

Docs

  • Rules: O6, R10, R11, P10, O7 and O9 amended. O6's When now covers a family read with a comma too, and the Turkic family has an Except of its own.
  • Decisions: dated 2026-11-19 entries in O6, R10, R11, P10 and O9. Notes in the vocabulary-model RFC and decisions/vocabulary-model mark their "a family comma marks nothing" clause as superseded.
  • Docstrings: ParsedName.surname2, Policy.two_family_names and the unit tags' comments are updated.
  • User docs and release log: usage, policy, languages and migrate (a 3.2 entry) carry doctests, and the release log has one bullet.
  • AGENTS.md: nameparser/AGENTS.md gains the lesson: a rule that marks something a view reads is compared across both writings.

Review

Reviewed with pr-review-toolkit: code-reviewer, pr-test-analyzer, comment-analyzer and code-simplifier, plus design-docs-reviewer. Every fix commit was reviewed again, a code-reviewer and a design-docs-reviewer on the fixes, and the findings of that round are fixed too. Skipped as inapplicable: silent-failure-hunter (no error handling added) and type-design-analyzer (no new public type; Case.views is a test-table field).

Checks: uv run pytest (51,049 passed), uv run pytest -n0 -m serial, uv run mypy, uv run ruff check, sphinx-build -b doctest docs (0 failures), python -m doctest README.rst, the suite without the ja extra, and the changed modules on Python 3.15.

🤖 Generated with Claude Code

derek73 and others added 2 commits November 19, 2026 14:12
…1456, #1479)

Under two_family_names the surname1/surname2 views now divide a family
of two surnames however it was read: before a family comma, where a
particle chain made it, behind a given name a particle completes
(rules/P10), and the family O9's capitals named. One function,
_post_rules._divide_family, decides for every path, O6's take
included: P1's fold units over the family in written order, a bound
given-name word counted with the word it completes, exactly two
marked, a first unit of particles alone, a connective, a shared name
and a Turkic father's name with its marker left whole. No field moves;
nothing moves with the switch off.

rules/O6, R10, R11, P10, O7 and O9 amended, with dated decisions
entries; the connective and the one-word hyphen question stays open in
decisions/R10. Case rows gain an optional views mapping.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73 derek73 added this to the 3.2 milestone Nov 19, 2026
@derek73 derek73 added bug particles Particles and surname prefixes (rules/P) name-order Name order, family-first and two family names (rules/O) commas Commas and name structure (rules/C) rendering render(), str() and the views (rules/R) labels Nov 19, 2026
@derek73 derek73 self-assigned this Nov 19, 2026
derek73 and others added 3 commits November 19, 2026 14:28
…479-surname-views-96f3a0

# Conflicts:
#	docs/release_log.rst
The capitals family is divided, the moves the issues did not ask for
are accepted, a lone particle ending a family stays the second unit,
and the connective and the one-word hyphen stay open; decided
2026-11-19.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#1456, #1479)

The review of the decision commit found the lone particle ending a
family decided only in a Log item, the rule's wording predicting a
division for Smith van der, Juan, which the code leaves whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73
derek73 merged commit 25423c5 into master Nov 19, 2026
12 checks passed
@derek73
derek73 deleted the claude/issue-1456-1479-surname-views-96f3a0 branch November 19, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug commas Commas and name structure (rules/C) name-order Name order, family-first and two family names (rules/O) particles Particles and surname prefixes (rules/P) rendering render(), str() and the views (rules/R)

Projects

None yet

1 participant