fix(C1): a particle surname before a comma is one name word (#575) - #576
Merged
Merged
Conversation
rules.md#C1 counts the words before a comma three times -- v1's "more than one word" for an unambiguous credential, the ambiguous class's name-word count (#289, #544), and assign's two-name-word test for the positional read -- and all three counted tokens or pieces. So 'De La Cruz, Ed' lost its given name and 'van der Berg, MA' split the chain (an unreleased regression against 2.3.0), and every release split 'van der Berg, PhD'. A particle and the name word it attaches to now count as one word, the reach P1's fold uses, so 'de Mesnil Jean' stays two words under a family-first order. The comma settles P1's fork for a leading 'van': the listing form puts a surname before it. Bound given-name pairs and connective joins are not counted as one (P5 builds a given name; P3 leaves 'Ortega y Gasset' three words), stated at _vocab.SURNAME_UNIT_TAGS. The unit walk moves from post_rules into _vocab.unit_ends, shared by post_rules' fold (full chain) and the C1 counts (fold reach). Segment runs before classify, so it builds its facts from the vocabulary (surname_unit_tags), held to classify's tags by a sweep test with a recorded negative control. 'De La Cruz, M.J. K.L.' now reads given 'M.J.' (Derek's call); 'Van Johnson, Dr.' reads family 'Van Johnson'. No pre-existing corpus name moves at any baseline; the gate exits 0 at all five. Cost: 'John Smith, PhD' 209 -> 217 frames, other measured names unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code (both reviews):
- A word that is also title vocabulary or a bound given-name head
('Freiherr', 'St', 'Abu') is no particle to the count before a comma:
the first draft folded 'Freiherr von Berg, PhD' into the family and
moved 'St John, PhD' and 'Abu Bakar, Ed' against every release.
- Assign's count walks every token, so a suffix word still stops a
particle: 'van Jr. Berg, Mr.' had read family 'van Berg'. Segment and
assign now derive their facts through one function each from one
set (surname_unit_tags / surname_unit_facts).
- The agreement test's negative control is stored and asserted with the
period-joined mirror patched out; stale comments corrected.
Docs (design review):
- rules.md#C1: the reach is P1's fold, not P2's chain; title and bound
particles excluded; the P3 reason restated (P3's join depends on the
whole name); a title in front is out of scope; 'Freiherr von Berg, Ed'
recorded as an accepted consequence (2.3.0's reading too). P3's
statement and mechanisms.md#UNIT-PARTITION's Contract name C1's count
as their exception.
- decisions.md#C1: corrected blast radius (one corpus name moves, of a
population of two), the real cost of the one-word reach, and the
version range.
- release_log: precise version range, the Van Johnson move, and the
#563 bullet's stale 'De La Cruz, M.J. K.L.' example replaced; the
#563 ledger comments updated to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ding The first review round excluded title-particles and bound given-name particles from the count in every position. The review of that fix found it brought #575's own defect back inside a surname ('de St Pierre, Ed' and 'De St. Croix, Ed' lost the given name again), and that excluding 'Abu' gave up 2.0-2.3's reading of 'Abu Bakar, Ed' (given 'Ed', family 'Abu Bakar') rather than keeping it. Now a title-particle is no particle only where it opens the part, and a bound given-name particle is a particle. 'Freiherr von Berg, PhD' and 'St John, PhD' keep the title; 'de St Pierre, Ed' and 'Abu Bakar, Ed' read given 'Ed'. The agreement test compares both positions; a case row pins the position itself. Also: the five ledger comments quoted a C1 sentence the first round rewrote; the blast-radius recipe gains its credential filter and comparator; the decisions entry says why the review's boundary rows carry no shape tag, and lists Abu Bakar, PhD among the moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The third review found assign's title-particle position flag unguarded: fixed to False or to True, every test passed. 'St John, Dr.' and 'von St Johann, PhD' now pin it one per direction, and both mutants fail. decisions.md#C1: the blast-radius recipe's second step now reproduces its "two" (ambiguous_class_candidate in the second segment; a filter on any suffix word keeps 17); the out-of-corpus moves are stated as the class they are, with examples measured against 2.3.0; the guard claim names which rows pin which count. rules.md#C1 interacts gains H1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #576 +/- ##
==========================================
+ Coverage 98.87% 98.89% +0.01%
==========================================
Files 45 45
Lines 4017 4070 +53
==========================================
+ Hits 3972 4025 +53
Misses 45 45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Since 1919 a former German noble title is part of the legal surname, written between the given name and the particle, so 'Freiherr von Berg, Ed' reading family 'Freiherr von Berg' is correct, not a cost -- the cost is the 'Prof. Cruz, Ed' half of the same listing-form rule. rules.md#C1's Accepted block, decisions.md#C1 and the ledger comments say so, and particles.py records why 'freiherr' is a particle at all (added in 3e14ea2 without a stated reason). 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.
Closes #575.
C1 decides whether a comma introduces the listing form (
Family, Given) or trailing credentials (Name, PhD). Part of that decision is counting the words before the comma: two or more name words mean the name is already complete. All three places that count, the ones listed under Changes, counted tokens or pieces. So a particle surname counted as several words:De La Cruz, EdEd, familyDe La CruzDe La Cruz, suffixEd, no givenEd, familyDe La Cruzvan der Berg, MAMA, familyvan der Bergvan, familyder Berg, suffixMAvan der Berg, suffixMAvan der Berg, PhDvan, familyder Bergvan der Berg, suffixPhDVan Buren, EdEd, familyVan BurenVan, familyBuren, suffixEdEd, familyVan BurenThe ambiguous-credential rows (
Ed,MA) broke earlier in this 2.4 cycle and that breakage never shipped. ThePhDrow (an unambiguous credential) was wrong in 1.4.0 through 2.3.0.The rule
A particle run and the one name word it attaches to count as one word. That's the reach P1's fold uses, not P2's whole chain, so
de Mesnil Jean, Dr.underFAMILY_FIRSTis still two words: familyde Mesnil, givenJean.Van Burenreads givenVan, but the listing form puts a surname before the comma.Van Johnson, Dr.moves the same way.Freiherr,St) is no particle only where it opens the part.Freiherr von Berg, PhDkeeps its title;de St Pierre, Edstays one surname.Abucounts as a particle, soAbu Bakar, Edkeeps 2.0–2.3's reading.De La Cruz, M.J. K.L.now reads givenM.J., suffixK.L.(Derek's call), the same asCruz, M.J. K.L..Freiherr von Berg, Edreads familyFreiherr von Berg, which is the right reading: since 1919 a former German noble title is part of the legal surname. That's also 2.0–2.3's reading. The same listing-form rule is a cost forProf. Cruz, Ed, recorded as accepted.Dr. van der Berg, PhDreads as its part does on its own.Changes
_vocab.unit_ends: the unit walk moved here from post_rules, with achainflag. Post_rules' fold uses the full chain; the C1 counts use the fold's one-word reach.surname_unit_count)name_word_count, which has a no-particle fast path)surname_unit_tags) and assign derives them from classify's tags (surname_unit_facts). An agreement test sweeps every single-word vocabulary entry in three casings and both positions, with a stored negative control. Case rows pin each count's position flag; mutating either flag to a constant now fails.García Márquez, G.J.has no given name #563 example), and ledger entries at all five baselines.Verification
fix(#575)classifies one name.De La Cruz, M.J. K.L., the decided move. The corpus holds only two names of this shape. Outside the corpora, the class that moves against 2.3.0 is a leading ambiguous particle plus one word before an unambiguous credential or a title alone (Abu Bakar, PhD,bin Laden, PhD,Van Johnson, Dr.).John Smith, PhDgoes from 209 to 217 frames per parse.Smith, John,John Smith, MAand the benchmark reference name are unchanged.Abudescribed backwards, an unguarded flag, false blast-radius claims. All are fixed and pinned. Details are in decisions.md#C1.Unblocks #564.
🤖 Generated with Claude Code