Skip to content

Take a hyphenated surname under two_family_names; example both switches (#959) - #1051

Merged
derek73 merged 4 commits into
masterfrom
feat/959-hyphenated-taken-surname
Nov 4, 2026
Merged

derek73 merged 4 commits into
masterfrom
feat/959-hyphenated-taken-surname

Conversation

@derek73

@derek73 derek73 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Closes #959. This PR covers what #961 left Open in decisions/O6 (two family names): the hyphenated-surname gap and the both-switches example.

Hyphenated surname taken

Parser(policy=Policy(two_family_names=True)).parse("Andrés Sánchez-Cid Torres") gives family 'Sánchez-Cid Torres'. 2.6.0 through 2.8.0 kept 'Sánchez-Cid' a middle name, because rules/O6 counted the hyphen's two words against the word it takes. As decided:

  • A hyphenated word counts as one name word when it is the word O6 takes.
  • A hyphen in the family still counts its words, so Javier Olmedo Pérez-Montaut is unchanged.
  • The veto reads each part. A hyphenated word every part of which is a listed given name or an initial stays where it is:
    • Ana María-José López under the Spanish list keeps middle 'María-José';
    • Ana M.-J. López stays under any lexicon.
    • Without a list, Ana María-José López reads family 'María-José López'. That is recorded as the switch's usual cost.

Measured on the cached ORCID researchers. Countries ES, MX, CO, PE, CL, VE and AR: 135,735 records, of which 10,794 distinct records hold a hyphen. Under locales.ES:

reading right fixed broken
master 10,281 — —
hyphen counts as one everywhere 10,038 277 520
taken word only, with the veto (this PR) 10,464 186 3
  • The "everywhere" variant loses because Latin-American family boxes write two surnames with a hyphen.
  • This PR fixes ES 125, MX 24, CL 20, PE 6, CO 5, VE 5 and AR 1.
  • With the switch alone, the same records move.

Accepted: a hyphenated bound pair (Ana Abdul-Rahman López) is taken like any hyphenated word. A veto for it was built and backed out: it cost 2 ORCID records whose hyphenated word is a surname (Abdul-Hadi Pru) and kept none.

Both switches

rules/O7's precedence over O6 now shows María del Carmen de la Vega:

  • family 'del Carmen de la Vega' with both switches on;
  • given 'María del Carmen' with O7 alone.

No behavior moves.

Docs and interaction

Review

An independent review found:

  • the stale docstring;
  • a wrong prototype figure (10,040 should be 10,038);
  • a missing dedup step in the recipe;
  • the release range;
  • the bound-pair and initial-plus-name spellings.

All are addressed in the second commit.

Checks

  • uv run pytest: 36,086 passed. Ruff and mypy clean.

🤖 Generated with Claude Code

derek73 and others added 2 commits November 3, 2026 18:49
…es (#959)

rules/O6 now counts a hyphenated word as one name word when it is the
word taken, so `Andrés Sánchez-Cid Torres` under `two_family_names`
gives family 'Sánchez-Cid Torres' where 2.8.0 kept 'Sánchez-Cid' a
middle name. A hyphenated word every part of which is a listed given
name stays (`Ana María-José López` under the Spanish list), and so do
hyphenated initials. A hyphen in the family still counts its words.
Decided in chat over ORCID's self-split names: under locales.ES the
change fixes 186 of 10,794 hyphenated records and breaks 3, where
counting a hyphen as one everywhere broke 520.

rules/O7's precedence over O6 gains the both-switches example
`María del Carmen de la Vega`, which decisions/O6 listed as Open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The veto reads each part of a hyphenated word: every part a listed
  given name or an initial keeps it (`M.-José` under the Spanish list,
  `M.-J.`); measured neutral on ORCID.
- A hyphenated bound pair (`Ana Abdul-Rahman López`) is taken like any
  hyphenated word, recorded under rules/O6's Accepted: a veto for it
  cost 2 ORCID surnames (`Abdul-Hadi Pru`) and kept none.
- Policy.two_family_names' docstring, the release range (2.6.0
  through 2.8.0), decisions/O6's 10,038 figure and its recipe's
  dedup step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 3.0 milestone Nov 4, 2026
@derek73 derek73 added the bug label Nov 4, 2026
@derek73 derek73 self-assigned this Nov 4, 2026
…-taken-surname

# Conflicts:
#	tests/v2/rules_budget.json
…-taken-surname

# Conflicts:
#	docs/design/decisions/O6-two-family-names.md
#	docs/design/rules/O6-two-family-names.md
#	tests/v2/rules_budget.json
@derek73
derek73 merged commit a7b5286 into master Nov 4, 2026
13 checks passed
@derek73
derek73 deleted the feat/959-hyphenated-taken-surname branch November 4, 2026 20:39
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.

Should two_family_names leave a known given name out of the family, so "José Luis Pérez" keeps family "Pérez"?

1 participant