Repository navigation
Ask one predicate per question for split credentials, numerals and paired initials (#752) - #884
Merged
Merged
Conversation
…ired initials (#752) Neutral. `_vocab.split_pair` replaces the three copies of the Ph./D. test (group's merge, `_comma._pieces`, `is_wholly_suffix`), each asking `SPLIT_PAIR_OPENS` C-level first so an ordinary word pays no frame. `_vocab.reads_as_generation` replaces `is_trailing_numeral_suffix` and takes the vocabulary path as `listed`, which C12's evidence passes. `_vocab.is_cased_paired_initials` lifts #872's inline script condition out of classify; C5 keeps the bare `is_paired_initials`. The regex roster named `_group._PH` and `_group._D` after both had moved to `_vocab`; a new test refuses an entry naming no pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mechanisms.md's ONE-PREDICATE-PER-QUESTION names the three predicates, decisions/vocabulary-model records the change, its neutrality measurement and what the later #752 changes widen, and the decisions entries and AGENTS.md naming the old numeral predicate point at its new name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) The design-docs review found the catalog calling `reads_as_generation` the numeral's one recognizer while S8's run start, C1's listing form and the peel's vocabulary path still recognize a numeral on their own; that `listed` carries C12's whole suffix-word tag, not a numeral test; that the peel's `is_suffix_piece` vetoes `i` and `v`, so passing `listed` at its fork would move `John J. V`; that the split-credential widening never reaches `is_cased_paired_initials` for `A. B.`; and two notes still naming the retired `PH`/`D`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The code review counted one frame per Ph word with a word after it, whether a D. follows or not; the entry had said per standing pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second review found the list of numeral sites missing C9's family-comma walk and the one-letter numeral behind a suffix word there, and the comment above reads_as_generation still calling it the numeral's one recognizer. The list is now stated as found by search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ared-predicates # Conflicts: # docs/design/decisions/vocabulary-model.md
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #884 +/- ##
=======================================
Coverage 99.07% 99.08%
=======================================
Files 47 47
Lines 4781 4785 +4
=======================================
+ Hits 4737 4741 +4
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ared-predicates # Conflicts: # docs/design/decisions/vocabulary-model.md
Merging master put two 2026-10-25 #752 log entries in decisions/vocabulary-model, so the Standing line pointing at 2a's names it by its opening words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The peel's veto is on the initial tag, not the shape; the numeral predicate's summary says what listed makes it answer; the split pre-test holds only while the first-word test is _PH; group alone declines a head pair; the site list lives in decisions/ only; import order and a cases.py note naming _vocab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…plit (#752) `reads_as_generation` no longer takes C12's suffix-word tag as `listed`: C12 asks whether the word ending the part is any suffix word or reads as a generation, and `Jr.` and `Esq.` are no numerals, so the tag test stands beside the call again, as on master, and costs master's frames. The listed numerals belong in the predicate, but reading them from the lexicon now would move `John J. V`, so that half waits for the change that has every numeral rule ask it; the decisions entry says so. The test review found no row holding a split credential without its periods, so making either period required passed the suite: four parity rows (`Ph D`, `Ph. D`, `Smith, John Ph D`, `John Smith, PH D`), a periodless pair in `test_is_wholly_suffix`, and unit tests that `SPLIT_PAIR_OPENS` is a necessary condition of `split_pair` and that `is_cased_paired_initials` refuses Thai `พ.บ.`. Re-measured on 2dd0414: the grid, the committed snapshot, every agreement record, PSC and the ctgov, FEC and tse local snapshots match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hem moves (#752) The review of the fix commits found that the shape test already takes ii to iv; only the one-letter i and v would be new, and they move 375 readings at the peel's fork and 144 reports at the numeral-before-a- credential report, not the peel alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #752: one shared predicate for each of three questions that #752's later changes widen. Neutral: no reading moves.
What changes
All three predicates are in
nameparser/_pipeline/_vocab.py.split_pair(first, second)handles the split credentialPh.D.(decisions/phd-merge). Group's merge,_comma._piecesandis_wholly_suffixeach had their own copy of the two-pattern test, and now all three call this predicate. The test runs on every adjacent pair, so each caller first asksSPLIT_PAIR_OPENSat C level. That is the predicate's own first-word pattern, so the pre-test can't drift from it, and a name withoutPh.pays no frame. A later change for ShouldJohn Smith Ph. D. Jonesread likeJohn Smith PhD Jones, or is the split spelling's reading the better one? #827 widens both together, to merge split credentials such asPharm. D..reads_as_generation(text, preceding, one_case)isis_trailing_numeral_suffixrenamed, as the predicate every numeral rule is to ask. Today it is the fork's shape half alone. C12 keeps its suffix-word test beside the call, as on master, because its question is broader: any suffix word (Jr.,Esq.) or a numeral that reads as a generation. The listed numerals belong inside the predicate, or each rule copies the vocabulary test again, which is how Should a known suffix right before a comma make it a suffix comma?Fabio Martini II, ADreads givenAD, familyFabio Martini#656's first draft missedVI. The shape test already takesii–iv, so reading the vocabulary would add only the one-letteriandv, and that moves readings: 375 at the peel's fork (John J. Vfrom family 'V' to suffix 'V') and 144 new reports (John J. V MD), because the ones those sites meet carry theinitialtag. That half waits for the change that has every numeral rule ask the predicate (ShouldJohn Smith VI MDread likeJohn Smith III MD? #784, ShouldJohn Smith V, M.J.keep V as the suffix, asJohn Smith Jr., M.J.keeps Jr.? #774, ShouldSmith, John PhD I, Jr.keepIas a middle initial, asSmith, John V, Jr.does? #819). The decisions entry lists the sites that still recognize a numeral on their own, with a reading for each.is_cased_paired_initials(text)is S3's "paired initials in a script with capitals". Classify used to test the script half inline (Read a surname written as two dotted initials as a name, not a credential (#864) #872). The lift puts that condition in one place for any later caller. C5 keeps the bareis_paired_initials: moving it would changeJohn Smith, พ.บ.(givenพ.บ.).tests/v2/test_regex_sync.py's roster still listed_group._PHand_group._D, though both had already moved to_vocab. Nothing checked an entry with no config key, so nothing failed. A new test now refuses an entry that names no compiled pattern, and I confirmed it fails on master's roster.Neutrality
Measured against this branch on 632685c, and again on 2dd0414 after phase 2a (#883) merged:
initials()andcapitalized(). The grid covers:MA,M.D.,X.Y.Z.,XYZ,Ph. D.and its case and spacing variants,V,VI,III,XI,M.J.,K.C.andพ.บ..split_pair), 18 (C12's call to the numeral predicate), 3,974 (the cased half) and 2,986 (the peel's call to it) readings differing.tests/v2/test_snapshot.pydoesn't move.cldr_agreement.pyrecord matches: CLDR, GND, Wikidata, conventions, native, and both locale views.local_agreement.py psc-individualsmatches its record. The record was already stale against 632685c (13 records moved before this change), so I re-recorded it from each base first.--tree, all match on both bases.sys.setprofile):_CALL_BASELINE's reference name (305) andSmith, John(158).Phword with a word after it:John Smith Ph. D.goes 233 → 234,Smith, John Ph. D.239 → 241.John Smith Jr., ADstays at 372, since the tag test runs ahead of the call.D.follows (ph ph ph ph ph ph282 → 286), so it grows only with such words. It's a rare shape that no guard counts.uv run pytest -n0 -m serialpassed three runs in a row. It failed once under a load average of about 10 from a parallel session, a different clock-timed row each time.Docs
is_cased_paired_initials, but its own item 6 refuses a split credential that opens with a single letter, so the length test answers first forA. B..cases.pynote no longer name the retiredPH/Dpatterns.Reads:line changes, because no stage reads a new field.Reviews
lenient_comma_suffixes=False,unlisted_dotted_suffixes=False,CapsSuffixes.EVERYWHERE/OFF, a delimiter policy and all three orders. It found 0 differences and no missed copy.PH/Dnames. Each is fixed in its own commit.Ph D,Ph. D,Smith, John Ph D,John Smith, PH D, each checked against the 1.4.0 wheel) and unit tests forSPLIT_PAIR_OPENSandis_cased_paired_initials. It moved C12's suffix-word test back beside the call, as above.Checks
uv run pytestuv run pytest -n0 -m serialuv run --python 3.15 pytest -quv run mypyuv run ruff checksphinx-build -b doctest docspython -m doctest README.rstPart of #752; doesn't close it.
🤖 Generated with Claude Code