Skip to content

Set apart a bracketed clause of credentials, generations or titles (#792, #771) - #1067

Merged
derek73 merged 3 commits into
masterfrom
feat/delimited-non-name-clause
Nov 5, 2026
Merged

derek73 merged 3 commits into
masterfrom
feat/delimited-non-name-clause

Conversation

@derek73

@derek73 derek73 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #792
Closes #771

The design question

Should one rule cover any phrase inside any known delimiter pair? The framing:

  • delimiters set a word or phrase apart;
  • a delimited clause is a nickname by default, or a maiden name where the caller declares the pair;
  • where the words inside are known credentials, titles and the like, the delimiters group them apart from the name, and the clause is neither.

Option B was decided: set apart a clause of unambiguous credentials and title heads, each word by its vocabulary, with the exclusions below.

Why it was inconsistent. rules/S1 didn't make a clause a suffix. It dropped the brackets and let the words join the name.

Input origin/master This PR
John Smith (PhD, MBA) nickname (1.4.0 through 2.8.0) suffix PhD, MBA
John Smith (MBA, PhD) nickname suffix MBA, PhD
John Smith (Dr) nickname (2.2.0 through 2.8.0) title Dr
John (Dr.) Smith middle Dr. title Dr.
John Smith (PhD) Withers suffix PhD Withers (2.4.0 through 2.8.0) family Withers, suffix PhD
Mr Hugh (Snr) Boyle middle Snr suffix Snr
Justin (JP) Stearns middle JP nickname JP
John Smith (Sir), (Mr) nickname nickname (lone title of address)
Alex Green, FRCS (SN) nickname nickname (a credential's qualifier: #1065)
John Smith (Hon), MRCP (UK) nickname nickname (modifiers and styles only)

#792's headline example, W. Russell (Jr.) Withers, had already moved back to middle Russell Jr. when #1039 gated Jr.. It now reads suffix Jr., family Withers.

The rule (rules/S1, rewritten)

A clause wholly of words the vocabulary reads as no name is set apart. It is no nickname and no maiden name, and the words around it read as they would beside a nickname. Each word takes the role its vocabulary gives it: a title is the title, and a credential or generation is the suffix. A word that is both is the title in front of the name's first word and the suffix elsewhere. A member of the ambiguous credential class (S4) joins the clause only where its writing settles it after the name (S13).

Exclusions, each of which keeps its pair's reading:

  • A clause of only title modifiers and styles: (UK), (Hon).
  • A lone title of address: (Sir), (Mr).
  • Titles alone straight behind a credential: FRCS (SN), which is a credential's qualifier.
  • A credential written as initials before a name word of its comma part: (JP), (R.N.). A title/suffix dual counts here only with a period after each letter, or in capitals in a mixed-case name. This exclusion came from reading the moves, not from the options as first put.

Other content ending in an ASCII period keeps v1's escape: the brackets are dropped and the content reads bare.

#771

rules/M2's Precedence bullet claimed a marker inside a delimited clause made the span the maiden name "whether or not the pair is a configured maiden delimiter". That is false for M3's Except cases. The bullet is now scoped to clauses that read as the maiden name. No reading moves.

Mechanism

  • _extract._set_apart: asks the vocabulary half and extracts the clause instead of dropping its brackets. _suffix_shaped became _period_escape.
  • _post_rules._set_apart_clauses: gives the clause's words their roles once the name's are read, and asks the exclusions that need roles. It trims a comma off a word's span; R1's entry pass parts suffix words at that comma.
  • _classify: tags a clause word without the comma written beside it.

mechanisms.md#CLAUSE-CONTENT-OVERRULES-DELIMITER records the split.

Measured

snapshot.py --local <source> --base <origin/master 84252268>, re-taken after rebasing onto master (the first measurement, against c620754, counted FEC 16):

Source Entries moved
ctgov-officials 26
fec-individuals 17
psc-individuals 10
orcid-researchers 79
govuk-people, ukec-individuals, cz-candidates, dof-signatures 0

decisions/S1 records the moves by class. Two ORCID nickname clauses gain an S13 suffix-or-nickname report on MEng,. The seventeenth FEC entry is an interaction with #877, merged since: TOBIN, MARY (V) keeps suffix V but loses the suffix-or-name report master gives it, because the clause is set apart after assign's walk reports. A letter its writer bracketed is not a middle initial in doubt, so rules/C9 now lists a bracketed letter among the slots that settle it (Smith, John (V) → no ambiguity).

CLDR agreement: one Czech rendering moves. In Machová, Alexandra Zuzana (paní, Ph.D.), the given names now agree with CLDR, and the title gains paní, which CLDR leaves out.

Accepted costs (S1's Accepted bullets):

  • FEC's state codes (ST) and (ME) read as titles.
  • (Lady) reads as a title, because lady is in neither address set.
  • John Smith, MD (Dr.) reads as a nickname.
  • (MPH) alone leaves the name empty.
  • Col. (Ret.) Smith reads suffix Ret., where 1.4.0 through 2.8.0 read title Col. Ret.. This re-pins two 1.x "known limitation" tests.

Reviews

Four reviews ran: code, design-docs, test coverage and comments. Then a review of the fix commits.

Code defects found and fixed:

  • A word with a comma stuck to it lost its tags, so (MBA, PhD) and (PhD, MBA) read differently and (Jr, PhD) lost its generation.
  • A leading comma stayed in the output.
  • Duals escaped the initials exclusion, and the first fix caught (Lt).
  • The widened R1 comma test joined (Jr.,) III.
  • One loop never ran.

Docs fixed:

  • S1's Then contradicted its Jack (PhD) example (N3).
  • The lead example (MBA) was S13's case.
  • The release spans were wrong.
  • The corpus counts had no recipe.
  • customize.rst, usage.rst and the _policy.py comments described the old escape.

The test review's unpinned branches are now rule examples. The suite passes on 3.11 and 3.15, and the serial benchmarks pass, with two new scaling rows.

🤖 Generated with Claude Code

@derek73 derek73 added this to the 3.0 milestone Nov 5, 2026
@derek73 derek73 self-assigned this Nov 5, 2026
derek73 and others added 3 commits November 4, 2026 21:16
, #771)

rules/S1 (a bracketed credential is not a nickname) dropped the
brackets of suffix-shaped content and let its words join the name, so
coverage depended on accidents: '(PhD, MBA)' and '(Dr)' read as
nicknames, '(Dr.)' as a title by its period, 'John (Dr.) Smith' as a
middle name, and 'John Smith (PhD) Withers' as suffix 'PhD Withers'.

A clause wholly of words the vocabulary reads as no name is now set
apart: no nickname, no maiden name, each word the title or suffix its
vocabulary makes it, and the name around it read as beside a nickname.
A member of the ambiguous class joins one where its writing settles it
after the name (rules/S13). Exclusions: a clause of title modifiers and
styles, a lone title of address, titles alone behind a credential, and
a credential written as initials before a name word of its comma part.
Other period-final content keeps v1's escape. classify tags a clause
word without the comma written beside it, and R1's entry pass parts
suffix words at a clause comma.

read as the maiden name. S13's twin-difference Accepted bullets are
gone, the twin now reading as the member does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov found the branch unreached: every lone member of the
ambiguous class that its writing settles after the name is a clause of
one non-name word to _set_apart_clauses, which runs first. What is left
of S13's pass is the report on a member left the nickname.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…surement on master (#792)

FEC's TOBIN, MARY (V) loses the suffix-or-name report master gives it:
the set-apart clause is read after assign's walk reports, and rules/C9
now names a bracketed letter among the slots that settle it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 force-pushed the feat/delimited-non-name-clause branch from 7a99a51 to 127b254 Compare November 5, 2026 05:27
@derek73
derek73 merged commit dadf39b into master Nov 5, 2026
13 checks passed
@derek73
derek73 deleted the feat/delimited-non-name-clause branch November 5, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant