Skip to content

Count abdul's four name words in the parse, not in classify - #1531

Merged
derek73 merged 6 commits into
masterfrom
fix/p12-long-names-late-split
Nov 22, 2026
Merged

derek73 merged 6 commits into
masterfrom
fix/p12-long-names-late-split

Conversation

@derek73

@derek73 derek73 commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

This PR builds the first behavior-changing candidate #1528 listed: abdul's four-word guard (rules/P12, written long_names_only on its reading, #1464) moves out of classify. The guard is now counted from the parse in post_rules. #1528's third candidate goes with it, because the numeral test lived in the deleted count.

What changes

  • classify tags every completes_any pair, abdul's included, and the count goes. That deletes _name_words, _BOUND_TAGS and _LEADING_TITLE_TAGS; nothing else read them.
    • The count was a hand copy of what later stages read: H2, H9 and H10's leading title run, the trailing run's suffixes and numerals, Should Ram Bahadur B.K. keep B.K. as its family name? #864's paired initials, and "nothing after the pair but an untagged word".
    • nameparser/AGENTS.md says such a guard "belongs where the parse has read them (post_rules here)".
  • post_rules counts the name words the parse read and splits an abdul pair back where there are fewer than four. It sits beside Should جميل عز الدين read family عز الدين, the الدين joining the word before it? #1072's two-word split, before H1.
  • What counts:
    • Tokens whose role after assign is given, middle or family, each holding a letter, so a lone mark (Tariq - Abdul Aziz) counts as none.
    • Titles, suffixes, nicknames and maiden names never count, whatever their vocabulary. A word the parse reads as a name always counts, whatever its vocabulary.
    • The two parts of a family comma count together, where the old count stopped at the next comma. Haddad Abdul Aziz, Tariq reads as its comma-less twin Tariq Haddad Abdul Aziz. A part past a second comma holds no name words (rules/C2), so nothing past it counts either way. No corpus name moved by this clause alone.
  • The split reproduces the parse without the join, and cuts the pair's piece in two for post_rules' later readers. rules/O9's layout is one of those readers. post_rules still returns group's pieces, because pieces are not a field it writes.
    • A pair opening the name's pieces belongs to rules/P5, and group leaves it without the tag, so it never reaches the split.
    • Behind a family comma, no role moves.
    • Elsewhere, the name's pieces are laid out by the order again (_assign._name_positions), the pair as two pieces.
    • The split removes BOUND_PHRASE_TAG from the bound word, so rules/O6's and O7's unit counts read the pair as two words, as they did when the join was declined. assemble drops the tag from published tokens, and neither suggest nor the name match reads it.

Measured moves (against master b339036)

Corpora. The population was every committed corpus name and every name in the 18 local corpora holding abdul: 26,430 names. Within it, classify's count was asked of a pair in 3,978.

  • The parse's count disagrees with the old one on 35 names.
  • 8 names move, 56 readings in all (each name under 7 of 20 configurations): two_family_names (with locales.ES, which sets it), two_given_names, FAMILY_FIRST, those combined, and capitals_as_family under FAMILY_FIRST or with two_given_names.
  • None move under the default. By corpus: PSC 6, ORCID 1, PatentsView 1, JRC-Names 0.
  • All 8 end in a contested title (vocab:title-ambiguous) that the parse reads as the family name. Invented example: Tariq Abdul Aziz King under two_family_names read middle 'Abdul Aziz', family 'King', and now reads family 'Abdul Aziz King'.

Grid. 4,921 invented names under the same 20 configurations moved 5,735 of 98,420 rows. Each move is one of four shapes the old count misjudged:

Shape Rows Example
a contested title ending the name, read by the parse as a name 2,524 King, Prince, Pope, Dean
a name word after a suffix the trailing run takes 2,865 Ali Abdul Rahim VI Hassan now reads middle 'Abdul', family 'Rahim'
a numeral behind an initial, read as a middle name 340 J. VI
a title word before a family comma 6 Pope, Tariq Abdul Aziz

The second shape is the only one that moves under the default policy (165 rows, toward the split). The old count counted Hassan, which the parse reads as a suffix. The #1464 decisions entry had recorded this shape as still wrong.

Proof

Guard Result
Oracle (on master): parse each name with the old count forced to join, count as above, and where the count is below four, parse again forced to split The branch reads identically on all 627,020 rows: grid and corpus names × 20 configurations, comparing fields, every token's tags and reading, each report's detail and alternative, initials() and str(). Control: plain master differs on 5,791 rows, the moves above
Second-round reviewer's own oracle grid 532,631 rows (12,991 names × 41 configurations, 9 caller lexicons among them), 0 differences
tools/differential/snapshot.jsonl No committed name moves. The record swaps one rules/P12 example for another (corpus_rules.jsonl regenerated)
cases.py 4 fix rows, each failing on master; 5 boundary rows (a mark behind a title, a mark after a family comma, the capitals layout, the tag strip, and the existing mark row), each killing the mutant it was written for
Full suite 58,009 passed (py3.11); 58,014 passed (py3.15, own environment)
Serial benchmarks 41 passed, the ±2% frame band and #1528's bound_pairs scaling row included
measure.py --base (merge base b339036) 30 steps, no moves
parity_check.py 0 of 811 parity rows read otherwise under 1.4.0 (second-round review)
mypy, ruff check clean

Frames per parse (py3.11; default / FAMILY_FIRST)

name master branch
Dr. Juan0001 de la Vega III (reference) 195 / 196 195 / 196
Smith, John 97 / 96 97 / 96
John Smith 89 / 90 89 / 90
Tariq Abdul Aziz Hassan 148 / 149 146 / 147
Tariq Abdul Aziz 128 / 129 143 / 144
Ali Abdel Mahdi Hassan Omar, Abu Bakr Mohammed Ali Hassan Omar Khalid unchanged unchanged
  • Tariq Abdul Aziz pays 15 frames: the pair is joined in group, then split back here and its piece cut.
  • Tariq Abdul Aziz Hassan pays 2 fewer, with no count to make.
  • The letter count runs inline before anything else, so a completes_any name of four words pays nothing.
  • The split runs once per name.

Docs

Declined

  • Simplify _classify.py with no reading moved #1528's second candidate, one shared pair walk: declined. It is not made free by this change: the walk from a second word still refuses a pair written across a comma, which the forward walk does not ask about, and sharing the guard would need its own tag comparison.

Reviews

PR review toolkit:

  • code-reviewer: one defect. The split left the pair one piece, which rules/O9 reads, so TARIQ Abdul Aziz under capitals_as_family read given 'Abdul Aziz'. Fixed in 5479feb, with a row.
  • pr-test-analyzer:
    • The P5 branch was unreachable: group leaves a P5 pair untagged. It is deleted in 5479feb.
    • Nothing pinned the tag strip; a row now does (cfcb29e).
    • The BOUND_SECOND_TAG guard survives its mutant, since with the shipped vocabulary no word heads both pairs. It is kept for caller lexicons.
  • comment-analyzer:
    • The docstring said "only the mark goes", but "mark" means a lone punctuation word elsewhere in this PR. It now says "the pair's tag".
    • The docstring now says the tag goes on every path.
    • The release bullet now lists a maiden name among the words not counted.
    • The roster comment and the citation's clause line are fixed.
  • design-docs-reviewer:
  • silent-failure-hunter, type-design-analyzer: not run, as not applicable: no error handling and no new type.

Second round on 5479feb and cfcb29e:

  • No code defects, by its own grid (above).
  • It confirmed that rebinding state touches no reader outside post_rules, that pieces and piece_tags stay in step, and that Parser.revise matches master.
  • One wording nit in the decisions entry, fixed in f19cbb5.

Open for a decision, not changed here: a name word now counts whatever its vocabulary, so a birth marker the parse reads as a name word counts too. For example, née Aziz Abdul Rahim reads family 'Abdul Rahim'.

🤖 Generated with Claude Code

derek73 and others added 2 commits November 22, 2026 10:35
Classify tagged an `abdul` pair only where its own count found four
name words, a hand copy of what the title runs, the trailing run and
the paired-initials rule would later read. It now tags every
`completes_any` pair, and post_rules splits an `abdul` pair back where
the words the parse read as given, middle and family names, each
holding a letter, number fewer than four, the parts of a family comma
counted together. The split reproduces the parse without the join: P5
reads a pair opening the name, a family comma moves no role, and
elsewhere the name's pieces are laid out by the order again.

The count misjudged a contested title the parse reads as the family
(`Tariq Abdul Aziz King`), a numeral behind an initial (`J. VI`) and a
title word before a family comma (`Pope, Tariq Abdul Aziz`); readings
move only under two_family_names, two_given_names and a family-first
order. `_name_words`, `_BOUND_TAGS` and `_LEADING_TITLE_TAGS` go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73 derek73 added this to the 3.2 milestone Nov 22, 2026
@derek73 derek73 added bug name-order Name order, family-first and two family names (rules/O) internals Refactors and parse cost with no behavior change labels Nov 22, 2026
@derek73 derek73 self-assigned this Nov 22, 2026
derek73 and others added 4 commits November 22, 2026 10:41
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The split re-laid out the roles but left the pair one piece, so
rules/O9's layout read `TARIQ Abdul Aziz` under capitals_as_family as
given 'Abdul Aziz'; post_rules now hands its later readers the pieces
with the pair cut, and returns group's pieces unchanged. The branches
for a pair opening the name were unreachable, group leaving P5's pair
untagged, and go. The records now name the shape the count also
misjudged under the default (`Ali Abdul Rahim VI Hassan`), give the
measurement's recipe, and point the superseded notes at the right
entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@derek73
derek73 merged commit 8268909 into master Nov 22, 2026
14 checks passed
@derek73
derek73 deleted the fix/p12-long-names-late-split branch November 22, 2026 19:29
derek73 added a commit that referenced this pull request Nov 22, 2026
…tries

The new #1531 sentence had replaced the one that "Moving the test later"
answers to, so #1464's narrowings read as #1531's; the old sentence is
back as history and the lesson follows #1531's in the paragraph. The
#1469 Standing line no longer leaves `haji` to a caller beside the line
saying locales.MS reads it; the 2026-11-19 entry's left-out question is
noted as declined; and the 2026-11-21 entry gives haji's counts, the
populations and its recipe. The #1059 entry says its figures come from
the issue's closing comment, which names no command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
derek73 added a commit that referenced this pull request Nov 22, 2026
* Bring the contributor docs up to the 3.2 cycle

Root AGENTS.md: `_normalize`'s edges (#1335, #1151), BOUND_SECONDS_LISTED
beside the second-word phrases, NameEvidence's ADDED_IN field, and the
initial veto as a property of the script rather than of Latin alone.
nameparser/AGENTS.md: a count of name words reads roles, not tags
(#1531), and a marker written with a full stop belongs in a title-run
grid (#1529). rules/README.md's glossary and C12/C16 follow #1531's
count and C6's widening; the vocab README and the locales exemplar
table name this cycle's packs. The open-issue paragraphs in AGENTS.md
and CONTRIBUTING.md no longer say the issues are being worked on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Bring decisions/ and mechanisms.md up to the 3.2 cycle

Two declines no decisions file recorded get dated entries: Catalan
`dels` (#1059, decided 2026-11-20) and the Bengali and Urdu honorifics
(#1469, decided 2026-11-21), with `haji` under locales.MS a Standing
line of its own. Open lines citing an issue since closed now say so
(#1268, #1231, #1178, #1179, #1468, #1149); S8's `Abd Allah` example
reads as P12's Latin join has it; P12's `عبد` count is dated; and
mechanisms.md names locales.CS beside locales.VI as a pack whose
fragment removes readings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Restore the one-word-path paragraph's history and complete the 3.2 entries

The new #1531 sentence had replaced the one that "Moving the test later"
answers to, so #1464's narrowings read as #1531's; the old sentence is
back as history and the lesson follows #1531's in the paragraph. The
#1469 Standing line no longer leaves `haji` to a caller beside the line
saying locales.MS reads it; the 2026-11-19 entry's left-out question is
noted as declined; and the 2026-11-21 entry gives haji's counts, the
populations and its recipe. The #1059 entry says its figures come from
the issue's closing comment, which names no command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Claim only the provenance the #1469 and #1059 records hold

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep only the routing in the open-issue paragraphs

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@derek73 derek73 mentioned this pull request Nov 22, 2026
derek73 added a commit that referenced this pull request Nov 22, 2026
* Release 3.2.0

The 3.2.0 release-log entry gets its summary and its date, and two
bullets it lacked: the parse cost (#1435, #1436), counted with
tools/perf/call_count.py against v3.1.0 (285.72 to 195.72 calls on
py3.11, 277.72 to 186.72 on py3.15), and the pickles 3.1 cannot load
(a Lexicon, Parser or matcher pickled by 3.2), re-checked with the
3.1.0 wheel outside the tree. README.rst announces 3.2 above the 3.0
and 3.1 notices; its Spanish and Argentine figures, re-taken with
decisions/readme-figures' recipe, read as they did. PRE_RELEASE is
cleared and CITATION.cff names 3.2.0. migrate.rst's Abdul entry counts
name words, as #1531 made it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Open the README's 3.2 notice with the vocabulary and the four new packs

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Word the README's 3.2 notice as decided

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Correct two release-log wordings the claims review found

The parse-cost figure is a mean over the reference name's 50 forms
(Juan0000 to Juan0049), and the bullet keeps one example, as the
release-log rule asks. The Malay pack's Tuan stays a name word with no
report, where Tan and Sri outside their phrase report title-or-name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Say where the Malay pack's Tan and Sri report

Only opening a name: Ahmad Tan Ali and Devi Sri Rajan report nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Place the README's 3.2 notice after the 3.1 one

The notices now read 3.0, 3.1, 3.2; the 3.2 notice follows the whole 3.1
block, its closing paragraph included, and stands before Installation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Place the README's 3.2 notice before the closing Getting started paragraph

The paragraph now closes all three notices: 3.0, 3.1 and 3.2, then
Getting started, then Installation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Name the two tools the README's Getting started paragraph takes a reader through

"Both" lost its referent once the 3.2 notice stood between it and the
3.1 notice's two tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Add two Hindi examples to the README's shapes

A Devanagari salutation in the Other scripts block, and the romanized
Shri read as a name by default and as the title under locales.HI in the
Language packs block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Lead the README's 3.2 notice with a short bold sentence

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug internals Refactors and parse cost with no behavior change name-order Name order, family-first and two family names (rules/O)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant