Repository navigation
Simplify _group.py with no reading moved - #1529
Merged
Merged
Conversation
Release checklist step 0's pass over the code `_group.py` gained since v3.1.0, chiefly rules/N4's alias take (#1164). - The alias in the given part after a family comma asked, per title, whether every piece after it closed the part, a quadratic in a run of titles after an alias; the closing run's start is found once (`_closing_run_start`), with a frame-ratio guard. - A refused alias take asked `leading_titles` of a slice per marker (C-level, quadratic); a refused marker that is no title bounds the run as a take does, `_clause_take`'s `lead` becoming the flag `run_ended`, with a `_SHAPES` row. - The alias boundary scan is a plain loop over `_ALIAS_ENDS` (`_MARKER_TAGS` plus the patronymic tag) in place of `_ends_an_alias`; a tail part is refused before the walk; `_clause_take` derives its report words from the role; MaidenTake and MaidenIndices, which carry alias takes too, are ClauseTake and ClauseIndices; the clause drop's token starts are built before the loop. - The module docstring names N4 in Consumes, Produces and Implements; a frame measurement in a comment moves to decisions/parse-cost. snapshot.jsonl is byte-identical, and a policy sweep over the committed corpora and 2,080 alias and maiden shapes reads alike against af58ca0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A refused alias marker bounds the leading title run only where the run stops at it, the run's own test negated (`_bounds_the_title_run`): the first build asked `is_title_piece`, which a period-shaped marker fails while the run takes it, so `Dr. Urf. Sr. Jr. @ Bob Smith` read given '@' where master read nickname 'Bob Smith'. - The tail-part refusal stays in `_clause_take` alone: refusing it in `_alias_takes` as well left the other unreachable. - The refused-take guard counts `leading_titles` calls (one per part) instead of timing a `_SHAPES` row, whose master reading sat within 15% of the bound; the title-scan guard reads a text with a closing run, so finding the run once per title fails it too, and its probe asserts the walk found the run. - Rows in test_group.py for where an alias stops in the given part and for the period-shaped marker; docstrings and comments reworded as the comment review asked; the decisions/parse-cost entry names #1529, states how its frames were counted, records both controls and gains a Standing line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…roup # Conflicts: # docs/design/decisions/parse-cost.md
… name - The parse-cost Standing line had landed under `Open:`; it joins the Standing list. - `_clause_take`'s comment named the `refused_alias_markers` row the first fix round replaced with a call-count test; it names the test. - The title-scan guard's control says its probe fails both recorded regressions first, the ratio backing a rewrite that renames the function. 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]>
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.
Release checklist step 0's /simplify pass over
nameparser/_pipeline/_group.py, covering the code it gained since v3.1.0 (git diff v3.1.0 -- nameparser/_pipeline/_group.py, 456 lines, chiefly rules/N4's alias take, #1164). It is quality only: no reading moves.It touches
_group.py, two tests intests/v2/test_benchmark.py, a test intests/v2/pipeline/test_group.py, a type annotation intests/v2/pipeline/test_pieces.py(the renamedClauseIndices) and a dated entry and a Standing line in decisions/parse-cost. It does not touch_vocab.py,_pieces.py,_state.py,_classify.py,_tokenize.pyor_suggest.py, and none of these changes needed them.Changes
_closing_run_startnow finds the run's start once, walking back from the end, and asks the same predicate per piece.is_title_piececalls on"Smith, Jane @ Bob " + "Dr " * k + "Xavier " + "Dr " * k: 59 at k=8 and 599 at k=32 (10.2x) on af58ca0, and 97 and 1,129 (11.6x) with the run found once per title, against 25 and 73 (2.9x) here.test_titles_after_an_alias_in_the_given_part_cost_linearly. Its probe asserts that the walk found the closing run, once."a @ Jr " * n), each marker askedleading_titlesof a slice of the part. That is C-level work no frame ratio sees: 7.2x to 8.5x for 4x the input on master._bounds_the_title_runis the run's own test, negated._clause_take'sleadstand-in becomes the flagrun_ended.leading_titlesis now asked once per part: 1 call where master made 2, 8 and 32 at 2, 8 and 32 markers.test_a_refused_alias_take_asks_the_title_run_once, a count rather than a clock. A_SHAPESrow was tried first, but master read within 15% of its bound on a loaded host._ALIAS_ENDS(_MARKER_TAGSplus the patronymic tag), instead of a generator calling_ends_an_alias, a third spelling of the marker tags. That is two frames fewer per piece._clause_takederives its report words from the role, sowordsis one parameter fewer.MaidenTake/MaidenIndicesbecomeClauseTake/ClauseIndices, since they carry alias takes too.givenbecomeskindwhere it named a role._apply_take'stakengets a default.Consumes:(theextractedpass drops an alias marker too),Produces:and its "Implements" line._clause_take's docstring had a stray sentence; it is fixed._apply_take's comment moves to a dated decisions/parse-cost entry, which also records the two scaling controls.Reads:line already matchedtools/stage_reads.py --stage group:Lexicon.given_name_titles,Policy.name_orderandPolicy.extra_suffix_delimiters, plus_comma.decide's.Proof that nothing moved
tools/differential/snapshot.jsonlis byte-identical (sha25647d678ce…) and was not re-recorded.PYTHONSAFEPATH=1, each__file__checked):corpus*.jsonlfiles plus 5,434 alias and maiden shapes (nineteen heads, among them period-shaped titles and markers, × eleven marker writings × twenty-six tails). That is 13,046 texts, each under the three orders ×middle_as_family×two_family_names, comparingrepr(tokens)andrepr(ambiguities).run_endedalways true moves 3,987 (334 texts).9c06606f, Simplify _tokenize.py with no reading moved #1527's tokenize pass, merged as1990eb73): the same sweep against9c06606fdiffers in 0 of 156,552 lines, and the snapshot equals master's.measure.py --basereports no moves in any of its 30 steps, against af58ca0 for the first commit and against9c06606fafter the merge (committed snapshot, CLDR/GND, every local snapshot, box agreement and the alike checks). Nothing shared was re-recorded.uv run pytest -n0 -m serialpasses 39 of 39, so the_CALL_BASELINEband holds.Frames per parse (py3.11, each name parsed once and then counted, all in one process, af58ca0 → this branch)
Dr. Juan0001 de la Vega III(reference)Smith, JohnJane Smith née JonesOsman @ @ JakiRahim @ Jaki bin OsmanSmith, Jane @ BobSmith, Jane @ Bob Dr Xaviera @ Jr a @ JrJane Smith @ Bob née JonesThe absolute counts depend on what the process parsed first; the differences do not. The 19 other names measured with each name order, comma and maiden shapes included, are unchanged. No row of the band moves, so there is no release-log bullet.
Considered and left alone
_clause_takeand_alias_takes'end_of_nameprediction (reuse and altitude reviews). Factored exactly it moves nothing, but it adds a frame per take. The two sites also ask about different words (the prediction asks about the alias's last word), so sharing it is part of candidate 3 below, not a refactor."suffix" in ptagspre-checks in front ofis_suffix_piece. Each pre-check saves a frame where the tag is present, so they stay._alias_takesbefore the walk (simplification review). It left_clause_take's own refusal unreachable, which codecov's project check caught, so it was reverted.Behavior-changing candidates (not applied)
The alias's title stop asking
_pieces.trailing_run_start, the walk's own bound._closing_run_starttakes any title, where the walk's trailing chain takes only chain titles andafter-givensalutations. So a bare title is handed back, and the walk then reads it as a name word.Smith, John @ Jack Sirgives nicknameJack, middleSir; with the shared predicate it gives nicknameJack Sir.@ Jack Lordandurf Jack Revmove the same way. rules/N4's Accepted bullet covers the current reading.The marker-behind-marker refusal on M2's side too.
_alias_takesrefuses an alias marker straight behind a marker of either kind, but M2's head test does not, so the maiden take counts an alias marker as the name word beforenée:Jane Smith @ née Jonesgives family@;Jane Smith urf née Jonesgives familyurf;Jane Smith née @ Jonesgives maiden@ Jones.Moving the test into
_clause_take's head would change all three and needs an amendment to rules/M2.end_of_namepredicts M2's take on the pieces before the alias is removed. The real take runs after the removal and asks about a different word:Jane Smith @ Bob and née Jonesgives nicknameBob and, maidenJones.John Smith @ Jack Jr née Jonesgives nicknameJack, suffixJr née Jones: the marker is swallowed and the maiden name is empty.A refused first marker left as the given name.
Jr. @ Bob @ Joe Smithgives titleJr., given@, familyBob, nicknameJoe Smith.Reviews
Simplify pass: four cleanup reviewers (reuse, simplification, efficiency, altitude). Their findings are applied above or listed as candidates.
PR review toolkit, first round (code-reviewer, pr-test-analyzer, comment-analyzer, design-docs-reviewer on
71bf9484):is_title_piece, which a period-shaped marker fails whileleading_titlestakes it.Dr. Urf. Sr. Jr. @ Bob Smithread given@where master read nicknameBob Smith. The grid held no period-shaped marker inside a title run; it now does._SHAPESrow's master reading was a coin flip against its bound. The title-scan test's text had no closing run, so it missed a once-per-title regression, and its probe would pass with the walk deleted.run_ended's antecedent, "patronymic reading"), the mergedstartscomments, and the PR body's frame counts.3d867b70, with codecov's project check (see above).Fix commit
3d867b70(code-reviewer): it moved no reading against af58ca0 over 231,606 systematic and 180,000 random parses across five lexicons and three orders, and the harness saw the first build's bound move 24 of them. It found:Open:;_SHAPESrow;All three are fixed in
5269769e, comments and docs only, which I checked myself.🤖 Generated with Claude Code