Repository navigation
Conversation
…amily (#659) An opt-in switch, off by default (rules/O9): in a name in mixed case, the run of words written in capitals is the family name wherever it stands, outranking a credential or title reading, and the other words keep their written order. Runs join across particles and conjunctions, a lowercase particle right before the run joins it, a run of particles alone or a lone roman numeral is none, the last of two runs is the family, a listed credential or numeral peels off the end of the run where a capitals word is left, and only the part before the first comma is read. Setting it with unlisted_caps_suffixes=CapsSuffixes.EVERYWHERE raises at construction. The decision as amended after the measurement gate is in decisions/O9, with the gate's measurements as dated snapshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, particles (#659) The code, silent-failure, design-docs, comment and type reviews of PR #1363 found, each reproduced on its head: - a report on a word the capitals did not decide was dropped (`Dean Mary DUPONT` lost title-or-name); now only a report on a word of the run, or a given-or-family report, is dropped; - the first word outside the run became the given name whatever it was (`JEAN y Perez` given `y`, `de Marie DUPONT` given `de`); now the first unit holding a word that may be a given name is, and a lowercase particle stays with the word after it; - a one-letter conjunction in capitals broke a run (`Ana LOPEZ Y GARCIA`), and a run could end in one (`Mary SMITH AND Jones`); - a particle in Title case was passed over by the mixed-case test (`MORRISON Van`); - the peel could leave a joining word ending the family. Also: the stage's Reads: header, the field docstring in paragraphs, CapsSuffixes.EVERYWHERE naming the constraint, the error offering both remedies, H3 and S8 Precedence bullets, dated counts, the decisions entries for each finding and the parliament re-take on the refreshed cache (kr_assembly reads none), and a guard row with its recorded control for every new condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… words (#659) A review of e04bd73 against its parent found its widened checks overreaching, each reproduced: - a particle in Title case counted as a name word while a run still joined it, so a name in capitals had no given name (`JAN Van DER BERG`); mixed case is now read over the words no run took; - a report outside the run survived where the capitals had moved its word or ruled out its reading (`Mary DUPONT Van` under FAMILY_FIRST, `Van Mary DUPONT`); particle-or-given and given-or-family reports are dropped wherever the rule acts, and any report on a word the layout moved, while a title or suffix fork on a word left in place stands; - a one-letter conjunction read by its vocabulary matched a dotted initial (`Ana LOPEZ Y. GARCIA`); only a bare one joins; - a never-given particle in Title case lost its written place (`De Marie DUPONT`); only lowercase joining words are passed over for the given name. The test analysis of the first head added guard rows, each with its recorded control, for the shapes its mutants survived, and found dead conditions, now removed: the peel's reversal, the capitals-only tag, full-stop handling for a word that holds none, the ambiguous suffix halves (subsets) and the clearing of P6's attachment mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…659) A review of the second fix commit against its parent, over 84,000 texts under fifteen configurations, found four more, each reproduced: - a report on a word the layout moved was dropped, measured against the positional reading, so `Dean Mary DUPONT` kept title-or-name given-first and lost it under FAMILY_FIRST; a title or suffix fork on a word outside the run now stands under every order; - clearing only P6's fold mark left a patronymic particle in capitals attached (`Siti AMINAH BINTI` under FAMILY_FIRST read patronymic `AMINAH BINTI`); both marks are cleared again; - mixed case was read before the peel, so a joining word it hands back gave no evidence (`DUPONT Van MBA`); it is read after; - the peel took a joining word listed as a suffix (`Joan MAS i MBA` read suffix `i MBA`); it takes only words in capitals, and the joining word it leaves is laid out with the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#659) The row's unit of particles (Ann DUPONT de LA MBA) is superlinear with the switch off too, 4.58x for 4x locally, and read 7.0x on CI's 3.13 runner; a conjunction join reaches the same run join and peel at 4.3x with the switch on and off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
The first of two PRs implementing #659's decision, as amended after the measurement gate. The amendment is the issue's comment of 2026-11-12 (#659 (comment)); the "Specification" section below is that wording as the reviews settled it. The second PR turns the switch on from
Parser.suggestand follows this one.What it does
A new opt-in switch,
Policy.capitals_as_family, off by default (rules/O9). It reads the words a name writes in capitals as its family name, wherever they stand:capitals_as_family=TrueDUPONT MarieDUPONT, familyMarieMarie, familyDUPONTAyla BURSALI AKSOYBURSALI, familyAKSOYBURSALI AKSOYJeffrey LAM Kin-fungLAM, familyKin-fungJeffrey, middleKin-fung, familyLAMHugo LACLAC, reportsgiven-or-familyLAC, no reportDOYEN HugoDOYEN, familyHugoHugo, familyDOYENThe
Jeffrey LAM Kin-fungrow is #1181's answer under the switch: the other words keep their written order.Specification (the decision as amended 2026-11-12)
O'BRIEN,ALLIOT-MARIE,McDONALDandd'ESTAINGcount. A word holding a full stop, slash or digit does not (DR.,N/A), nor does anything in brackets or quotes, initials joined by a hyphen (J-P), or a word whose capitals are one letter (PhD).Aude BROSSARD de VILLEMONT), a listed one-letter conjunction written bare included (Ana LOPEZ Y GARCIA;Y.is an initial);Mary SMITH AND Jones→ familySMITH);Jean de LA FONTAINE);Karim AL Haddadi,John Smith III).PETER Okello MUWANGA).Dr. ANITA ROY,MARIA de SOUZA LIMA,JOHN McCAINandJAN Van DER BERGare unaffected;MORRISON Vanis read.de Marie DUPONT→ givende Marie) and a unit of nothing else is a middle name (JEAN y Perez→ givenPerez); a particle written with a capital may be the given name (De Marie DUPONT,Van Mary DUPONT).Marie GRAJALES III,Jean DUPONT MBA), but never leaves only particles (Anna DE CARO), and only at the end of the name.Dupont, MARIE).unlisted_caps_suffixes=CapsSuffixes.EVERYWHEREraisesValueErrornaming both values and offeringPolicy(capitals_as_family=True, unlisted_caps_suffixes=CapsSuffixes.AFTER_COMMA). A test executes the offered code. It raises fromPolicy(...), frompatched()on either side, fromdataclasses.replaceand fromparser_forwith a pack.Jan GM Brouwer→ familyGM; 4,246 ORCID records);John Smith MD→ familyMD; 757 ORCID records, none from a source that writes families in capitals).DRin capitals at the head reads as the family (DR Anna Berg; 204 ORCID given boxes). It is recorded as rules/O9's last Accepted bullet and decisions/O9'sOpen:line.Where it runs
_post_rules._family_in_capitals:John Smith,Smith, JohnandJohn Q. Smithare 125, 135 and 176 on this branch and on the merge base._vocab.is_capitals_wordis the word test, shared with PR B. A new internal tag,capitals-family, which reaches no published token, makesToken.readinggive the family words' source asshape, the source the type already names for "a word in capitals".Ambiguity reports (decided by
nameparser/_pipeline/AGENTS.md), where the rule acts:particle-or-givenandgiven-or-familyreports (the capitals said where the family is), and anysuffix-or-nameortitle-or-namereport on a word of the run (DEAN Hugo,Hugo JUNIOR);Dean Mary DUPONTkeepstitle-or-name).The rule emits nothing of its own, since the caller declared the convention, as O6 and O8 do.
capitalized()leaves a name in mixed case as written, soDUPONT MarierendersMarie DUPONTand keeps its capitals.capitalized(force=True)givesMarie Dupont: the family is named by its field by then.Measurements
The gate (before code; scripts and outputs in the 3.1 session notes,
659-gate/; dated snapshots in decisions/O9)The capped
orcid-researchers/raw.jsonlthe decision read was no longer cached. I read the full ORCID 2025-10 dump instead (24,990,909 records), with a 20,000-a-country cap to approximate the corpus. Not measured: France's register and LegCo (not cached), and the parliament datasets fetched after 2026-11-08 (Korea, Indonesia, Ethiopia, Israel).ORCID: which box holds the capitals (records where one box is wholly capitals words and the other holds none):
The coordinator's figures were 90.1% and 87.3%. Where the family box is in capitals, the prototype read both fields right in 396,793 of 396,946 records, composed either way.
Parliaments, capitals taken as the family, the shipped switch (
parliaments_shipped.py; cache refreshed 2026-11-12, 23 datasets)tr_parliamentaz_parliamentkz_mazhilisThe refreshed cache adds
kr_assembly, which the gate could not measure. Of its 297 names in Latin script, 293 are written wholly in capitals (PARK SUNGHOON) and 4 in mixed case with no word in capitals, so the switch reads none of them.Switch off
cldr_agreement.pymatches every record.snapshot.py --local <source> --base <checkout of 670b3498>"matches the base" for 15 fetched corpora: ctgov-officials, cz-candidates, dof-signatures, fec-individuals, govuk-people, jrc-names, nepal-candidates, orcid-researchers, patentsview-inventors, psc-individuals, tse-donors, tw-donors, uit-vinames, ukec-individuals, vn-assembly.snapshot.py --local opensanctions-parliaments --base <checkout of 2b39f23d>matches the base.Switch on (
sweep_on.py, all three orders)The grid: 26 heads × 8 wrappers (title, suffix, suffix comma, nickname, maiden clause, salutation) plus 7 comma shapes.
Marie DUPONT,DUPONT Marie Ann,Ayla BURSALI AKSOYandJeffrey LAM Kin-fung.Also checked:
initials()givesM. D.,surname2is empty, andReadingisname as family, shape.east-slavicandturkicthe patronymic view is kept (ИВАНОВ Иван Иванович→ patronymicИванович).Parser.reviseand pickling round-trip.Parser.matching().check("DUPONT Jean", "Jean Dupont")is consistent under the switch (familyfolded) and conflicts without it.Tests
cases.py: two default rows (parity; 1.4.0, 2.0.0, 2.8.0 and 3.0.1 read them so, run 2026-11-12) and elevenfeat(#659)rows, one per comma shape and order. Each feat row fails on the merge base, which has no such field.test_rules_doc.py, two of them construction subjects (raises=).test_post_rules.py::_CAPITALS_GUARDShas 40 rows, at least one per condition of the rule, each with its recorded negative control (the reading, or the exception, with the condition deleted, measured on dd5cb4d). All 37 mutations, one per condition, fail at least one row. Conditions removed because nothing reaches them:is_capitals_wordgets 30 spelling rows;_EXPECTED_READINGSgets three rows; the 3.0.1 pickle fixtures load with the default; refused-skew rows for both types; the CLI flag; the field rosters (test_policy,test_parser,test_suggest's base sweep,test_cli); and a_POLICY_SHAPESscaling row (the peel loop was made linear first).Decisions for the maintainer
capitals_as_family: bool, besideinitials_as_familyandmiddle_as_family. Alternatives considered:family_in_capitals,caps_family.MARIA y LOPEZ GARCIAis read as a name in capitals);MARY SMITH Jr.is unaffected);MORRISON Vanis read;De Marie DUPONTgives givenDe);Artur MAS I GAVARRO→ familyMAS I GAVARRO); written elsewhere it is the initial T4 and P8 read (Mary Y SMITH).Mary Van DUPONT→ middleVan);THE ROCK Mary→ titleTHE).Hon CHAN Kin-por GBS JP→ familyGBS). With LegCo's commas it reads right. This is an Accepted bullet.[rules]key: no pack sets the switch, per the decision, sotools/vocab/build.py'sRULE_KEYSdoes not offer it.Docs
docs/policy.rst: a table row and a section, Family names written in capitals.ADDED_INroster.nameparser/AGENTS.md: the spelling sweep's new class, A word written in capitals, with what the gate found.docs/usage.rst's list of CLI flags does not name--capitals-as-familyyet. That file was outside this PR's scope while the docs rewrite ran, so it is listed for the coordinator.Reviews
Each review ran as a subagent in its own detached worktree at the pushed head, with a read-only base, briefed with the diff and the issue only. I reproduced every finding below with a command before fixing it. Fix commits: e04bd73 (round 1), 446d992 (the review of e04bd73) and dd5cb4d (the review of 446d992).
design-docs-reviewer:
Ana LOPEZ Y GARCIA);All fixed.
code-reviewer:
MORRISON Van);de Mesnil JEAN Paul);Reads:header did not name the field;All fixed. Recorded rather than changed:
Marie II DUPONT(familyII DUPONT), and O6 standing down under the ES pack (already a Precedence bullet).silent-failure-hunter:
Dean Mary DUPONT);de Mesnil Jean DUPONT);All fixed. Recorded: the CLI prints the Python call rather than flag names, and a hand-built pickle state can hold the forbidden pair (the shared guard does not re-validate, by convention).
comment-analyzer:
JEAN y Perez);All fixed.
type-design-analyzer: keep the
bool; the constraint is enforced on every path. Recommended adding the constraint toCapsSuffixes.EVERYWHERE's docstring, splitting the field docstring into paragraphs, and a test that a patch holding both values raises only when applied. All done.pr-test-analyzer: 47 mutations, 20 survived. Rows were added for each survivor with an input that moves; two recorded controls were relabelled; the dead conditions were removed (above).
Review of e04bd73 (code-reviewer): the widened mixed-case test let a run swallow its own evidence (
JAN Van DER BERG, 3,030 grid rows lost the given name); reports survived on words the capitals had moved; dottedY.joined runs;De Marie DUPONTlost its order. All fixed in 446d992.Review of 446d992 (code-reviewer, 84,000 texts × 15 configurations): every move traced to the stated hunks, and four more findings, all fixed in dd5cb4d:
Dean Mary DUPONTlosttitle-or-nameunderFAMILY_FIRST);ATTACHED_TAGclearing, which I had judged dead from a probe in lowercase, mattered for a capitals patronymic particle (Siti AMINAH BINTIunderFAMILY_FIRST);DUPONT Van MBA);Joan MAS i MBA).Review of dd5cb4d (mine, on the same grid against its parent): every move traces to those four changes:
Checks
Run on dd5cb4d (master 943318d merged in):
uv run pytest: 46,404 passed (thejaextra installed). Without the extra, 46,288 passed on 60d250c.uv run pytest -n0 -m serial: 36 passed; frame counts forJohn Smith,Smith, JohnandJohn Q. Smithstill 125, 135 and 176.uv run mypy,uv run ruff check,sphinx-build -b doctest docs,sphinx-build -W -b html docs,python -m doctest README.rstandtools/vocab/build.py --check: clean.Refs #659
Refs #1181
🤖 Generated with Claude Code