Skip to content

Read a credential split across a space as one word (#752, phase 2e) - #891

Merged
derek73 merged 13 commits into
masterfrom
claude/phase2e-split-credentials-0fc06f
Oct 25, 2026
Merged

derek73 merged 13 commits into
masterfrom
claude/phase2e-split-credentials-0fc06f

Conversation

@derek73

@derek73 derek73 commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Phase 2e of #752: a credential written split across a space reads as one word. This carries out item 6 of decisions/vocabulary-model's 2026-10-23 #752 entry, which Derek agreed on 2026-10-23, and #827's reading (A). Closes #827.

What changes

Split credentials (new rules/S12, a credential split across a space).

  • Two adjacent words are one credential when:
    • each is one to five letters, the first of two or more;
    • their letters together spell unambiguous suffix vocabulary;
    • they are not both suffix vocabulary on their own;
    • neither is a particle or a connective, and no connective borders the pair.
  • The merged piece is a member of the ambiguous class, and the count decides it:
    • S4's words to spare at the end of a name;
    • C4's count after a comma;
    • S5's reading at the end of the given part after a family comma.
  • Where the count declines the pair, it is split back into the two words it is written as, so it reads exactly as before. This is the new mechanisms.md entry MERGE-THEN-SETTLE.
input master this PR
John Smith, Pharm D given Pharm, middle D, family John Smith given John, family Smith, suffix Pharm D
John Smith Pharm D Jones middle Smith Pharm D, family Jones suffix Pharm D Jones, reported
John Pharm D middle Pharm, family D unchanged (no words to spare)
SMITH, SAM E. given SAM, middle E. unchanged (same is listed; C4's count refuses it)
John Smith, M. D. reversed unchanged (opens with a single letter, the accepted cost)

#827. The merged Ph. D. now starts S8's run from where it stands: John Smith Ph. D. Jones reads suffix Ph. D. Jones, as John Smith PhD Jones does.

V Ph. D. A one-letter numeral in front of the pair reads as it does before PhD, following Derek's 2026-10-25 call on #886: John Smith V Ph. D. reads family V, reported, where 2.3.0 through 2.6.0 read suffix V Ph. D.. This is the spaced twin's reading, so no new decision is needed. No local corpus name holds the shape, so only the rules example moves.

Decisions this PR states (please check)

  1. S8's run start. S8 refuses a member of the ambiguous class as a run start. The split pair is the one member that starts the run anyway: its other reading is two name words, and the run starts only behind the two name words its own count asks for. S8 now says this as a Precedence bullet.
  2. Reported (Derek, on this PR's review). Wherever the count takes the pair it reports suffix-or-name, as any member of the ambiguous class does (John Smith MA). This covers the end of a name, after a comma, the end of the given part, a run start and a maiden clause's release. Without the report, a given name and initial that spell a credential (John Smith Ed D, JOHN SMITH SAM E.) would become one where no caller could find them.
    • The cost: a report on pairs nobody hesitates over (John Smith Pharm D).
    • A declined pair reads as its two words did, with no report, as on master.
    • After a comma, a part the comma's decision already reports as a whole gets no second report.
  3. Ph. D. stays the unambiguous credential decisions/phd-merge reads. It is merged by its spelling whatever the vocabulary lists, as v1's fix_phd was, and it outranks an overlapping pair (Jane Doe Dr. Ph. D., where Dr. Ph. spells the listed drph).
  4. Two dotted single letters are asked of Read a surname written as two dotted initials as a name, not a credential (#864) #872's is_cased_paired_initials. They merge only in a caseless script that writes abbreviations, and no default entry spells one.
  5. The part before a family comma merges no pair, since it reads no member as a suffix (Smith MA, John).
  6. Case repair writes a pair in the suffix as its one-word twin, by the fold's mask: john smith, PHARM D gives Pharm D, and MB ChB force-repairs to MB ChB where master wrote MB Chb.

Accepted (rules/S12):

  • M. D., M D and M. Sc. stay two words. Of ctgov's 205 distinct names whose whole part after the comma is one of the five split spellings, 133 still read reversed, against 185 on master. The design record's "149 of 359 officials" counted M. D. and M D only; M. Sc. opens with a single letter too, so it stays unmerged as well.
  • A given name and its initial whose letters spell a listed credential read as it, now reported. This happens behind two name words with no comma (JOHN SMITH SAM E.), and ending the given part after a family comma (Smith, John Sam E.).

Measured (2026-10-25, against master 225f3d6, every local check with --base)

Re-taken against master b1e5a29, after #890 merged: every figure below holds. PSC agrees on 1,004,785 records there, #890's own count.

corpus result
committed snapshot 2 names move, both rules examples; 28 new rules examples
CLDR, GND, Wikidata, conventions every agreement record matches
ctgov-officials 469 entries move (breakdown below)
tse-donors 2 move: JUNIOR typed as JUN IOR; the pairs view is unchanged
fec-individuals 1 moves: USN R
nepal-candidates none
psc-individuals matches the base: 0 fixed, 0 broken, 0 changed (1,004,782 of 1,039,171 agree on every field)

The ctgov moves:

  • 353 readings carry the pair's report.
    • 119 of them had no suffix-or-name report on master.
    • The rest are MB ChB-style names, where the pair's report replaces master's report on the word MB's run absorbed.
  • 128 move a field, each a split credential read whole: Pharm D and its spellings 110, Psy D 5, Dr PH 5, Ed D 3, Sc. D. 1, and MB ChB behind another degree 4.
  • 339 move only the force-repaired case view, as decision 6 below says.
  • 2 move the unforced case view too: ph D, written in two cases, is now kept as written, as rules/R5 keeps its twin phD; master wrote Ph D.

The opening-letter test protects FEC's middle initials. With it removed, 4,441 FEC names would move (G. MR. reading as gmr in 2,577, C. MS. as cms in 1,133), against 206 ctgov names it would put right.

Frames. The reference row, John Smith, Smith, John and accented names cost what master does. A name holding a split credential pays for its reading.

The spike figures in the design record were a cruder rule's. This PR's rule adds the count gate, the particle and connective refusals, and decide's retry.

Reviews

  • First code review: a 3,726-text grid under three orders. It found seven defects, all fixed:
    • a connective joining the merged pair;
    • phd removed from the vocabulary stopping the Ph. D. merge;
    • a merge before a family comma;
    • case repair differing by comma shape;
    • a frame per pair in accented names;
    • a maiden report naming the wrong word;
    • an unrecorded comma-form cost.
  • Design-docs review: found two more code defects, both fixed: a bound given name absorbing the pair after a family comma, and dotted CJK pairs merging. It also found ten record corrections.
  • Second review of the fix commits: found four defects in the fixes, all fixed:
    • Moving the given-part merge after the joins let a particle chain take the pair's first word (Smith, John van Pharm D). The merge now runs ahead of the joins, and P5's bound join declines a split piece, which rules/P5 now says.
    • A lexicon listing ph and d stopped the Ph. D. merge.
    • Overlapping pairs were repaired twice by case repair.
    • A pair written in two cases was repaired where its twin is kept as written.
  • Review of the report commits: found a pair reported twice behind a credential that opens the part after a comma (Smith, MD Pharm D). C13's absorbed-word report now leaves a split pair out, so the pair reports itself once.
  • Each code fix has a case row or a test, checked to fail on the first version.

Docs

  • New: rules/S12 and decisions/S12, and mechanisms.md's MERGE-THEN-SETTLE.
  • Amended rules: S8, S10, S7, C4 and P5. The deviates: #827 marker is removed.
  • Amended decisions: S8, S10, S7, C13, phd-merge and vocabulary-model.
  • Also amended: the RFC, and AGENTS.md (a sweep lesson: a pair predicate meets overlapping pairs and joining words).
  • Release log: two bullets.
  • Rules budget: re-recorded. S8, C4 and S12 grow; S7 and S10 shrink. The rule and decisions file are S12: Gate generation readings by kind: fils, the Brazilian agnomens, default = false (#752, phase 2h) #890 took S11 first.

🤖 Generated with Claude Code

derek73 and others added 7 commits October 25, 2026 12:14
A pair of short words whose letters together spell unambiguous suffix
vocabulary, the first of two or more letters, merges into one piece, a
member of the ambiguous class that the count decides (rules/S11): S2's
trailing read by S4's words to spare, C4's count after a comma, S5's
reading at the end of the given part. A pair the count declines is
split back into its two words (`_group._settle_splits`, and a second
reading of the part in `_comma.decide`), so it reads as written.

The merged Ph./D. pair now starts S8's run as `PhD` does (#827), and a
one-letter numeral in front of it is the name word it is before `PhD`
(`John Smith V Ph. D.` -> family 'V').

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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
derek73 and others added 6 commits October 25, 2026 13:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ase 2e)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t-credentials-0fc06f

# Conflicts:
#	docs/design/decisions/README.md
#	docs/design/decisions/vocabulary-model.md
#	docs/design/rules/README.md
#	docs/release_log.rst
#	nameparser/_pipeline/_classify.py
#	nameparser/_pipeline/_comma.py
#	nameparser/_pipeline/_pieces.py
#	tests/v2/pipeline/test_vocab.py
#	tests/v2/rules_budget.json
#	tests/v2/test_cases.py
#	tests/v2/test_render.py
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 2.7 milestone Oct 25, 2026
@derek73
derek73 merged commit a46b3a6 into master Oct 25, 2026
12 checks passed
@derek73
derek73 deleted the claude/phase2e-split-credentials-0fc06f branch October 25, 2026 23:47
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 John Smith Ph. D. Jones read like John Smith PhD Jones, or is the split spelling's reading the better one?

1 participant