Skip to content

Title-case Mac in case repair unless a mask records the name (#1014) - #1016

Merged
derek73 merged 3 commits into
masterfrom
fix/issue-1014-mac-case-repair
Nov 3, 2026
Merged

derek73 merged 3 commits into
masterfrom
fix/issue-1014-mac-case-repair

Conversation

@derek73

@derek73 derek73 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Closes #1014.

What changes

capitalized() no longer gives an inner capital after a Mac prefix by shape alone:

input before (1.4.0 – 2.8.0) after
JOHN MACHADO John MacHado John Machado
MARIA MACIAS Maria MacIas Maria Macias
JAMES MACKENZIE James MacKenzie James Mackenzie
RONALD MACDONALD Ronald MacDonald Ronald MacDonald (mask)
J.MACDONALD SMITH J.MacDonald Smith J.MacDonald Smith (chunk mask)
JOHN MCDONALD John McDonald unchanged
  • Mac is title-cased unless the vocabulary records its casing. 42 Gaelic surnames written MacX by most of their bearers (more than half of at least three writings) carry a cased mask on a family reading. Name readings may now carry cased (_reading_index.BEHAVIORAL), and an entry holding only such a reading compiles, so the build no longer warns it inert.
  • Where the masks live. They are in en.toml, the anglicized spellings being English ones. They are listed again in gd.toml (37) and ga.toml (the Irish MacCarthy, MacMahon, MacManus, MacDermott), so parser_for(locales.GD/GA, strict=True) keeps them.
  • A chunk after a full stop takes its own mask, as a hyphen part already did. This keeps J.MacDonald, and it lets credential chunks take theirs in forced repair (Phd.Md → PhD.Md, Msc.Ed. → MSc.Ed.).
  • Mc keeps its convention. _render._MAC becomes _MC, matching Mc alone (nameparser.config.regexes, which held the public copy, left master in Remove nameparser.config.regexes in 3.0? The parser has not read REGEXES since 2.0 #1008).

Measured (2026-11-02)

The sources are ORCID's family-name box plus the names in the UK Electoral Commission donors, GOV.UK people and ClinicalTrials.gov officials local corpora. Each writing was counted as typed; the recipe is in decisions/R4's 2026-11-02 #1014 entry.

writings match the writer
Mac: old rule (always MacX) 4,616 of 970 words 16.3%
Mac: plain title case 83.7%
Mac: title case + 42 masks 91.2% (in-sample)
Mc convention 6,312 96.8%

Bearers of the Gaelic names split by family: MacDonald 143 vs Macdonald 77, Mackenzie 59 vs MacKenzie 44. So no shape can decide them, and a per-word mask can.

Accepted costs:

  • An unlisted Gaelic name loses its capital: SHIRLEY MACLAINE → Shirley Maclaine. The release log points callers to Lexicon.capitalization_exceptions.
  • Mc names that aren't Gaelic stay McX: Mchunu → McHunu.

Moves

  • Committed snapshot: case views only, no role moves. Czech Macáková/Machová, Macías and Machbuba are fixed; Shirley Maclaine and the fictional macdole-eisenhower are the accepted cost; forced Msc.Ed. → MSc.Ed..
  • snapshot.py --local ctgov-officials --base master:
    • 619 moves of names containing mac.
    • 126 of names without it, all credential chunks.
  • ukec-individuals: 69 moves, all Mac names.

Docs

  • rules/R4 (case repair reads the unjoined mark): a new bullet on Mac masks, a full-stop example, and the Mc wording.
  • rules/R5 (the case-repair gate): its examples are renamed from Shirley Maclaine to Ronald Macdonald, since the forced repair of the old one now changes nothing.
  • decisions/R4 and R5: Standing bullets and log entries.
  • Also updated: the vocab README, the release log and rules_budget.json.

Checks

  • Full suite, -m serial benchmarks, mypy, ruff and build.py --check pass.
  • New tests: a mask-only surname entry compiles and isn't inert, with a negative control on each half of the model change. Strict GD/GA packs keep the masks, with a negative control: the strict rows fail without the gd/ga entries.
  • The design-docs reviewer ran two rounds. The first found six issues, all fixed: chunk masks, strict-pack claim, Mc wording, recipe numbers, Mc recipe, stale Standing line. The second found the fixes sound and two notes, both recorded in the decision entry.
  • Not run: the suite on Python 3.15 locally. CI covers it.

🤖 Generated with Claude Code

Case repair capitalized after any `ma?c` prefix, so a single-case
MACHADO repaired to MacHado, MACIAS to MacIas. Measured over 4,616
mixed-case Mac writings in four local corpora, that matched the
writer's spelling 16.3% of the time; plain title case 83.7%.

Mac is now title-cased unless the vocabulary records its casing; Mc
keeps its convention (96.8% of 6,312 writings). 42 Gaelic surnames
written MacX by most of their bearers (at least three writings) get
masks as `family` readings carrying `cased`, which name readings may
now carry: in en.toml, and again in gd.toml and ga.toml by origin so
a strict Gaelic choice keeps them. Measured match with the masks:
91.2% (in-sample).

A chunk after a full stop now takes its own mask, as a hyphen part
does, so J.MACDONALD keeps its capital (J.MacDonald) and credential
chunks take theirs (Phd.Md forced -> PhD.Md).

rules/R4 and R5 amended; decisions/R4 records the measurement and
recipe; REGEXES["mac"] keeps its key and matches Mc alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added bug vocabulary Per-word vocabulary model and language packs labels Nov 3, 2026
@derek73 derek73 self-assigned this Nov 3, 2026
…case-repair

# Conflicts:
#	nameparser/config/regexes.py
#	tests/v2/test_regex_sync.py
@derek73 derek73 added this to the 3.0 milestone Nov 3, 2026
@derek73
derek73 merged commit 98b4552 into master Nov 3, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug vocabulary Per-word vocabulary model and language packs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should MACHADO repair to Machado rather than MacHado?

1 participant