Skip to content

Read a salutation ending the given part after a family comma as the title (#835) - #876

Merged
derek73 merged 7 commits into
masterfrom
fix/issue-835-trailing-salutation
Oct 25, 2026
Merged

derek73 merged 7 commits into
masterfrom
fix/issue-835-trailing-salutation

Conversation

@derek73

@derek73 derek73 commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #835.

Doe, Jane Mrs now gives title Mrs, given Jane, family Doe, where 1.4.0 through 2.5.0 gave middle Mrs (all three wheels checked). It already read that way written Doe, Jane Mrs., and so did Doe, John Jr Mr. The FEC's donor file writes FAMILY, GIVEN MIDDLE SALUTATION and often leaves the period off.

The rule: H8, a salutation ending the given part

After a family comma, the surname's place is marked. A bare word ending the given part can then only be a middle name or a title. A salutation is a form of address, not something a person is named after. So a listed salutation there joins H5's trailing title chain, as a period-marked title already does. One consequence: the bare and period-marked spellings read alike in every comma shape and under every name order. That covers the empty head, the nickname head, particle and connective surnames, second commas, suffixes and other titles.

  • Not affected: other title kinds (Doe, John King, Doe, Jane Dr), title/suffix duals (Doe, Jane Ms), and the comma-less writing, which stays H5's (Jane Doe Mrs keeps family Mrs).
  • Accepted costs (rules/H8):
    • A middle name that is a salutation reads as the title (Doe, Jane Miss).
    • With nothing before the comma, the one given word moves to the family, as the period-marked spelling has done since 2.3.0 (, Jane Mrs).
    • Under a declared family-first order, the comma-less Doe Jane Mrs keeps middle Mrs. So the family-comma invariant in decisions/two-input-invariants no longer holds for trailing salutations: 738 of 738 pairs agreed on master, none now.

Vocabulary

There's a new behavioral title property, after_given = true. A build check allows it on salutation readings only. It compiles into AFTER_GIVEN_TITLES and a new Lexicon.after_given_titles. It has no v1 Constants attribute; the shim intersects it with titles.

88 salutations carry the flag. A middle name may be a given name or a surname, so a salutation borne as either is excluded, with its counts recorded on the word:

  • goodman, herr, herren, master, mister, señora, señor, signor, signore, herra, härra, paní, fru, frú, пан
  • the Bengali মোঃ/মো (they abbreviate Mohammad), श्री/শ্রী, and बाबू (Babu)
  • hr, after the FEC read below

A non-Latin word is weighed by its romanization only where its bearers write that script. The line at roughly 200 US bearers is a judgment call. decisions/H8 has the counts and the reasoning.

Parser

  • trailing_titles (and tail_reading) take a salutations flag that admits a word tagged vocab:after-given-title by classify.
  • Assign's family-comma walk passes it, and so do the two group-side predictors of that part: the particle chain's bound (trailing_run_start) and the bound given-name join's decline. All three therefore read the part the same way.
  • The flag is an inline tag test, so no new call frames: the serial benchmarks didn't move.

Measured (decisions/H8 records each with its recipe)

  • Grid: across 9 comma heads × 21 given parts × 7 salutation spellings × 6 tails × 3 name orders, all 23,814 bare rows read exactly as their period-marked twins (fields and ambiguity kinds). No period-marked row moved against master. The reviewer reproduced this on a 128,700-row grid of its own.
  • Committed corpora: no name moved. The snapshot gains only the new rule examples, and every CLDR/GND/Wikidata agreement view matches its record.
  • fec-individuals: 12,381 of 1,893,964 names move: MR 9,339, MRS 1,908, MISS 1,108, MR.. 24, plus 2 joining a title already there. 385 of them drop a CONJUNCTION_OR_INITIAL report, since the letter no longer has a name word behind it.
  • ukec-individuals: no moves.
  • Not decided here: in 59 FEC names, a lone I or V is left at the end of the given part and reads as a generational suffix (DOE, JANE I MRS). DOE, JANE I and DOE, JANE I MRS. already read that way on master, under Issues with names in the format Last, First Middle Suffix where Suffix is I #144's rule for a trailing letter after a family comma.

Compatibility

A Lexicon or Parser pickled by an earlier release no longer loads (ValueError naming the missing field), as happened in 2.1 and 2.3. The release log says so.

Review

Three review rounds, each fixed in its own commit:

  • Design-docs review, twice. Round one found ten problems: stale "read as the comma-less name reads it" text in H5, P5 and the AGENTS.md Gotcha, the bare-word doctrine stated without the exception in four more places, vetting gaps (बाबू, fru), the unrecorded family-first disagreement, an empty-head row outside H8's When, and small count errors. Round two, on the fix commit, found five, including a false "has always read it" (true only since 2.3.0).
  • PR review (code, tests, comments). The code reviewer found no bugs. The test reviewer's mutations showed three behaviors no test caught: the Lexicon field's API, the classify guard, and the flag's hand-off to tail_reading's second chain pass. Each now fails a test when broken (a field/API and off-switch test, an orphan test, and a bare-vs-period-marked parity sweep over 2,112 pairs). Eight comment items were fixed, and a final review of that fix commit tidied five more.

AGENTS.md gains one lesson: vet a non-Latin word by its romanization. The lone I/V this change leaves ending the given part (59 FEC names) is filed as #877.

Checks

  • uv run pytest: 24,212 passed. -m serial: 39 passed.
  • mypy and ruff are clean, and tools/vocab/build.py --check reports the compiled vocabulary current.
  • Sphinx doctest and HTML builds print nothing, and README doctests pass.
  • A py3.15 subset passed, but on an earlier commit (before the review fixes).
  • master (Phase 4: order and shapes, the rules a pack can choose, and the output model #754) merged in; the snapshot differs from master's only by this PR's 24 rule examples.
  • Re-recorded: rules_budget.json (H8 is new, H5 and P5 grew), corpus_rules.jsonl, snapshot.jsonl, and the field-sweep claim count (1,400 on master → 1,403).
  • The migrate.rst "Changed in 2.6" entry is left for the 2.6.0 release, with the cycle's others.

🤖 Generated with Claude Code

derek73 and others added 3 commits October 24, 2026 21:35
…itle (#835)

`Doe, Jane Mrs` reads title 'Mrs', given 'Jane', where 1.4.0 through
2.5.0 gave middle 'Mrs'. After a family comma the surname is fixed, so
the only reading a bare salutation there competes with is a middle
name, and a salutation is a form of address rather than something a
person is named after (rules/H8).

A new behavioral title property, `after_given`, allowed on a
salutation reading only, compiles into AFTER_GIVEN_TITLES and
Lexicon.after_given_titles. Salutations borne as given names or
surnames are excluded with their counts (goodman, herr, master, ...).
H5's trailing title chain admits a flagged bare word in the given part
after a family comma, and the group-side predictors of that part do
too, so a bare salutation reads exactly as its period-marked twin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review found the docs this change made stale and three gaps in
the vetting.

- Vetting: exclude बाबू (romanized Babu, a US surname and an element
  of Indian given names), fru and frú (a Cameroonian surname); record
  the kept words' counts on the words; state the romanization
  criterion in decisions/H8.
- rules/H8: widen When to the empty head and doubled stops (`Mr..`),
  and add Accepted clauses for the empty head and for the comma-less
  writing under a declared family-first order, which keeps the
  salutation a name word (738 of 738 pairs agreed on master, none now).
- Stale text: H5, P5 and the H Background said the given-part
  predictors read the part "as the comma-less name reads it";
  decisions/H5's Standing and its #316 head, vocabulary-exclusions,
  and four places in AGENTS.md now name the H8 exception.
- A shim test pinning the v1 knob (deleting the title), with its
  negative control; the release note names Parser pickles too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rules/H8: the period-marked `, Jane Mrs.` has read Jane as the family
  since 2.3.0 (H5), not always (1.4.0 through 2.2.0 gave first 'Jane');
  the Signal line and the spelling clause match the widened When.
- gospodin's nam_dict given-name band is recorded on the word, and
  decisions/H8 says why it is kept.
- "the comma having fixed the surname" now reads "marked the surname's
  place", which holds for the empty head too.
- The shim test's comment says what pins what: classify holds the parse,
  the set assertion holds the intersection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 2.6 milestone Oct 25, 2026
@derek73 derek73 added enhancement design vocabulary Per-word vocabulary model and language packs labels Oct 25, 2026
@derek73 derek73 self-assigned this Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.07%. Comparing base (5a75c1d) to head (65f4c65).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #876   +/-   ##
=======================================
  Coverage   99.07%   99.07%           
=======================================
  Files          47       47           
  Lines        4779     4781    +2     
=======================================
+ Hits         4735     4737    +2     
  Misses         44       44           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

derek73 and others added 4 commits October 24, 2026 22:16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing-salutation

# Conflicts:
#	tests/v2/test_cases.py
#	tools/differential/corpus_rules.jsonl
#	tools/differential/snapshot.jsonl
Tests for what three mutations showed the suite could not see:
- Lexicon.after_given_titles' API (add, remove, |, normalization, the
  bare-str TypeError, pickle, repr) and rules/H8's off switch;
- the orphan contract classify's `n in lex.titles` guard holds, for an
  entry removed from titles and one added to the marker only;
- a bare-vs-period-marked parity sweep over family-comma heads, given
  parts and tails under all three orders (2,112 pairs, ~0.5s), which
  fails on 192 pairs if the salutation flag stops reaching
  tail_reading's second chain pass, plus the case row
  'Doe, abdul Mr Jr Mrs';
- every shipped after_given title reaching H8 at its slot.

Comments: the after_given_titles field doc moved off
capitalization_exceptions' comments; trailing_titles' docstring, the
build's invariant list and its error message, the _group comment, the
release-log bullet (period-marked spelling read as the title only since
2.3.0), an undated count in a case note, and AGENTS.md's "always" in
the period-abbreviation Gotcha (1.4.0 through 2.2.0 read
`Doe, Jane Mrs.` middle).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Date the parity sweep's measurement 2026-10-24, the day it was taken.
- The build's after_given refusal reads "allowed on a salutation
  reading only, not on 'nobility'", fixing the article.
- Type the sweep's helper with ParsedName instead of two type ignores,
  and re-wrap its docstring.
- Pin at parse level that a period-marked after_given entry matches the
  bare word, as the test's comment says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit 8c965d7 into master Oct 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design enhancement vocabulary Per-word vocabulary model and language packs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should Doe, Jane Mrs read Mrs as a title rather than a middle name?

1 participant