Repository navigation
Conversation
Quality-only pass over the changes since v2.8.0 to _post_rules, _group, _pieces, _vocab and _classify; no reading moves (snapshot byte-identical). - suffix_kind: drop the credential arm of the suffix-word branch, which the earlier CREDENTIAL_WORD_TAG return makes unreachable. - split_pair: the Ph./D. test asks suffix_as_written, whose dotted and joiner arms bare `phd` cannot reach, instead of a hand copy of its middle arm. - _post_rules: the dotted-member test of S1's set-apart pass and of the delimited-member report is one helper, _dotted_member, each caller passing the text it passed before and asking "." first in C. - _DOTTED_INITIALS lives in _vocab, which builds _INITIALS_SHAPE from it; _post_rules imports the same object (test_regex_sync roster). - P1's fold computes the chain's reach once under a family-first order and hands it to _family_first_lead_folds; a restated lead_fires test goes. - P10's no-marked-word guard moves to post_rules' call site, so a name with no particle-given word pays no call: one frame off every parse. - name_word_count asks the numeral's shape in C before ends_in_a_generation, as group's count does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the first commit found two folds paying a frame on a path
that grows with the input:
- `_post_rules._dotted_member` cost one frame per dotted clause or
nickname word ('John (M.B.A, M.A) Smith' +3), where the two inline
tests cost none. Back to the two inline copies, each asking its own
text (the set-apart pass strips the kept comma, the report does not).
- `split_pair`'s call into `suffix_as_written` cost one frame per Ph./D.
pair. Back to the inline test.
test_layering's 4i-a count returns to 128 with them.
The test review found S1's comma strip on a dotted member untested
(dropping `.strip(",")` failed nothing): `John Smith (M.A, PhD)` reads
suffix 'M.A, PhD', nickname 'M.A, PhD' without it. A direct test in
test_post_rules, not a case row: the row trips test_stage_field_ownership,
the set-apart pass rewriting a word's text and span, which the stage
map does not list (left for a follow-up outside this pass's files).
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.
Pass (b) of the three pre-3.0.0 simplify passes. It covers only the rule stages (
_post_rules,_group,_pieces,_vocab,_classify), limited to code changed since v2.8.0. This is a quality-only change: no reading moves.Changes
suffix_kind. The credential arm of the suffix-word branch could never run, because theCREDENTIAL_WORD_TAGreturn above it already catches that tag. Removed._DOTTED_INITIALS. It now lives in_vocab, which builds_INITIALS_SHAPEfrom it. Before, the two modules held hand copies of one pattern, each declared its own source._post_rulesimports the same object, andtest_regex_sync's roster records it._family_first_lead_folds. The restatedlead_fires andtest is gone._given_phrase_middleto its call site inpost_rules. A name with no particle-given word now pays no call, which takes one frame off every parse.name_word_count. It now checks the numeral's shape in C before callingends_in_a_generation, as group's count already does. The shape match is a necessary condition, so no answer moves.test_a_dotted_member_keeping_a_comma_in_its_clause_is_set_apartfills the gap the test review found (see Reviews).The first commit also folded two hand copies into shared predicates: a
_dotted_memberhelper andsplit_pairaskingsuffix_as_written. The frames review showed each added a frame for every dotted clause word and every Ph./D. pair, so the fix commit reverted both to their inline forms (see Reviews).Proof that nothing moved
tools/differential/snapshot.jsonlis byte-identical to master (git diff --quiet origin/master -- tools/differential/snapshot.jsonl).test_snapshot.pypasses and nothing was re-recorded.cldr_agreementand every doc test,test_doc_citations.pyincluded, pass unchanged.uv run pytest -n0 -m serialpasses, 54 of 54 on each interpreter. Three wall-clock scaling rows failed one run each during this work, one of thembracket_members. Each passed alone 3 of 3. The load average during those runs was 40–48, from parallel sessions.test_benchmark.pyscaling and shift-count tables are unchanged.uv run mypyanduv run ruff checkare clean.Frames per parse
Measured with
sys.setprofile"call" events, master (git archiveat 5138879, path asserted) against the branch head. Each cell shows the default order / FAMILY_FIRST.Dr. Juan0001 de la Vega III(reference)Smith, JohnJohn SmithJohn Smith, Jr.Smith, John Q. Jr.John (MA) SmithSt de Mesnil JeanFreiherr von RichthofenMaría del Carmen GarcíaMaría del Carmen García, which stays level._CALL_BASELINE's 307, +1.3%, inside the ±2% band. Pass (a), Simplify the output side's 3.0 changes (assemble, types, render) #1085, takes about 5 more off every parse, and these changes stack on top of that.Reviews
two_family_names,two_given_names,middle_as_family, and four phd lexicons (removed, ambiguous, as a word credential, with a given reading).initials()andcapitalized()._dotted_memberadding +1 per dotted clause or nickname word (John (M.B.A, M.A) Smith+3) andsplit_pair's call intosuffix_as_writtenadding +1 per Ph./D. pair. Both ran on paths that grow with the input. Resolved: both reverted to the inline tests in 22dc6f1. Every other site removes frames or leaves them unchanged._dotted_member, and test_layering's count note named S1 for an S13 load. Resolved: both lived in code the fix commit reverted..strip(",")from S1's set-apart dotted-member test failed nothing, whileJohn Smith (M.A, PhD)reads nicknameM.A, PhDwithout it. Resolved: a direct test intest_post_rules.py, whose control I ran: it fails with the strip removed. Acases.pyrow was tried first and trippedtest_stage_field_ownership(see follow-ups). The other surviving mutation,_family_settled's default-reachpath, is masked by the main fold and unchanged in behavior.git diff origin/masterovernameparser/shows only the five surviving changes. The reverted hunks match master byte for byte, with no leftover import or comment, andtest_layering.pyis identical to master.''and nickname'M.A, PhD'. Second, the separate strip that rewrites the word's text (_post_rules.py:738, master code) is pinned by no test; dropping it readsJohn (Dr, Prof) Smithas title'Dr, Prof'. That gap is in the follow-ups below.Behavior-changing candidates (not applied)
Each was measured by patching a scratch copy of the branch and parsing the 6,939 snapshot names plus a 22-name grid under all three orders against the unpatched branch.
suffix-or-nicknamereport:John (M.A,) Smith,John (M.A.,) Smith,(M.A,), PhD.set_apart_kindaskingsuffix_as_writteninstead of its own suffix test. Raised by the altitude reviewer. A joined credential in a clause becomes the suffix:John Smith (MD/PhD),John (MD/PhD) SmithandJohn Smith (MD-PhD)read suffix where they read nickname. It moves 3 grid names and 0 snapshot names. It would also absorb the separate dotted-member test, but loses thememberflag rules/S13 reads, so it needs a design pass.generation_word_before_a_namedelegating its "name word behind" test to_pieces._name_word_behind. Raised by the altitude reviewer. The two exclude differently: initials, connectives, titles, maiden markers, shape-read numerals, and capitals in a mixed-case name. It moves 6 names, 2 of them snapshot names, and all for the worse:Eric H. Holder Jr. Attorney Generalloses title and suffix (middleH. Holder Jr. Attorney).dr. Margaritta Marionna Maria de Planta jr. CFreads familyCF.John Smith Jr. CF,John Smith Jr. J. Jones,John Smith Jr. Dr. JonesandJohn Smith Jr. JONESeach move a suffix run into the name.Not a candidate as written. Any merge needs a rules/S8 decision.
Follow-ups outside this pass's files
textandspanwhen it trims a kept comma. The map inParseState's docstring andtests/v2/pipeline/test_state.pydoesn't list that write, and it has passed vacuously because no case row trims one._post_rules.py:738rewrites a word's text. No test pins it:John (Dr, Prof) Smithreads title'Dr, Prof'without it. It is master code, and the same write the stage map omits._comma._whole_name's C3 numeral clause. A C-levelROMANpre-check would save two frames per suffix-comma name with two or more words before the comma._comma.pybelongs to no pass._post_rules._idx. About 10 calls per parse; grouping them would save about 20 frames on 3.11. That code predates v2.8.0.ParsedName.ordervalidation (about 5 frames per parse). Taken by pass (a) in Simplify the output side's 3.0 changes (assemble, types, render) #1085.Considered and not taken
merge_piecescomment'sjoin_connectiveshistory and its 2.4x–2.9x / 54,877-name measurement. decisions/ doesn't hold them, so deleting the comment would lose them._has_letterhelper for P10's and O7's letter tests, and one loop for O7's two tag tests. Both are cosmetic and on rare paths.🤖 Generated with Claude Code