Repository navigation
Count the particle chain's units in S2's read instead of merging a copy (#620) - #622
Merged
Merged
Conversation
… prototype) The trailing read marks each piece by the unit P2's chain will put it in (_chain_units: opens, joined, bound) and the peel counts words to spare, #602's run start and tail_reading's resume in those units. The chain and the read share chain_run_end. The merged counting view, its exclusion list, its view index and its credential-run gate are gone. Docs to follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- run_start counts in the chain's units too: a particle opening a run
counts once, its bound particle and joined words not at all ('John
der la Jr. Prof. Smith' keeps #602's run; 'van la Smith Secretary
Jr. Dr. Smith' starts none, as before #614).
- credential_run gathers adjacent particles on the read's path into
the one piece the chain makes of them, so an absorbed run reports
as before #614 ('Mc Mc'); M2's view still reports word by word.
- The numeral fork keeps reading the piece in front as written
(rules.md#P2's 'John van der J. V'); 'John van B and Smith X' is
back to 0c54662's reading.
- tail_reading's resume test needs no units clause: fuzzed over
372,330 names, none differs; the reason is in the comment.
- Eight rows #614 labelled `parity` did not match 1.4.0; relabelled by
bisect. Three new rows, two unit-mark tests, a report-token test;
every new branch killed by a recorded mutation.
- Docs: rules.md#S2 (run start) and P2's implemented line,
decisions.md#S2 (#620 entry) and parse-cost, mechanisms.md
UNIT-PARTITION and READ-WITHOUT-THEN-BIND, AGENTS.md (parity means
1.4.0). Pins: 307/344 on 3.11, 288/325 on 3.12-3.15.
Measured against 4278693: fingerprint 0, connective grid 20 (all back
to the pre-#614 reading), S2 grid 640 (508 back, 128 Freiherr-chain
acronyms by the two-name-words invariant, 4 one garbage name).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The review found the first count wrong where both masters were right:
marking every word the chain reaches JOINED let a member the chain
would join count as no word in front of the next ('Freiherr von Berg
MA X.Y.Z.' kept 'MA X.Y.Z.' in the family), and let a unit made only
of words the read then takes move the name's start into the titles
('St St VI', 'Freiherr St MA' read the numeral or acronym as the whole
family, unreported).
- _weighed: a word the trailing read weighs (suffix word, ambiguous
class, by-shape member, initial, roman numeral by shape, period-
marked title) keeps a unit of its own, as a position counted it;
only plain words behind a particle run are JOINED, and a unit with
nothing past its opener moves no name start.
- Against master as merged: fingerprint 0, connective grid 0, S2 grid
12 (three garbage names). Frames equal master's; the 3.12-3.15 pin
is corrected to 289/326, stale since #614's /simplify.
- Rows for the review's regressions and for its six test gaps (a title
spliced off before the unit count, a P3-joined particle phrase), two
report-token asserts, killers for each _weighed arm; every new
branch dies under a recorded mutation.
- Docs rewritten for the redesign: decisions.md#S2's #620 entry and
parse-cost, rules.md#S2, mechanisms.md (numeral fork reads as
written; the copy's defects were patched, not live), the anchor
comment, AGENTS.md (an exclusion list being replaced carries rules).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
/simplify pass, behavior-preserving: the suite, the five gates and the fingerprint, connective and S2 grids (byte-identical) unchanged; frames unchanged (308 on 3.11, 289 on 3.12). - tail_reading looks up where the second unit opens once and hands it to every peel pass. Each pass had rescanned from the front, a C-level quadratic behind a long joined surname (5.77x for 4x the input against master's 4.08x, now 4.03x) that no frame guard saw; test_the_second_unit_is_found_once_per_read counts the lookups. - The peel stops at any piece the chain joins into a run, not only a bound particle: a joined word the reading does not weigh was going to break the walk anyway, after the suffix test's frames. - credential_run gathers an absorbed particle run off the BOUND marks instead of re-testing particles and adjacency; run_start's two counting branches are one condition. - _weighed is pinned to the reading: no piece marked JOINED is ever in the run the read takes (negative control: 320 grid names). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #622 +/- ##
==========================================
+ Coverage 98.99% 99.01% +0.02%
==========================================
Files 46 46
Lines 4468 4481 +13
==========================================
+ Hits 4423 4437 +14
+ Misses 45 44 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Refs #620. It doesn't close it: the two related paths #620 names (reading a family comma's given part the same way, and deciding the name's start once for a title-particle head) move readings and are left for a follow-up, as scoped.
What changed
#614 read S2's trailing run once, ahead of the particle chain, through a merged copy of the pieces. That copy was a second statement of P2's chain with its own stop list, and its reviews found three defects that came from it: an index applied across two layouts, a title hidden inside a credential run, and a numeral folded into a unit. Each was patched inside the copy.
Now nothing is merged:
_pieces._chain_unitsmarks each piece by the unit the chain will put it in: OPENS, JOINED (a plain word the chain joins to the run in front) or BOUND (a particle inside the run). It askschain_run_end, the chain's own run end, which_group's chain now calls too._weighed): suffix words, the ambiguous class, by-shape members, initials, roman numerals by shape, period-marked titles. A unit with nothing past its opener moves no name start into the titles.John Smith PhD Jonesreads middleSmith PhD#602's run start count in those marks. The walk stops at any piece the chain joins, and everything else reads the pieces as written.credential_runreports an absorbed particle run as the one word the chain makes of it (Dr. John Smith Esq. RN Mc Mcreports 'Mc Mc'), as before Rethink the credential-run rule (S2): read a name's trailing run once, over name units, and bind it before any join #614. M2's clause view still reports word by word.What moves
Measured against master as merged (4278693), py3.11,
nameparser.__file__asserted, with the harnesses and recipe in decisions.md#S2:The three names:
Freiherr von Berg Dr. X.Y.Z. VDreads H5's trailing title 'Dr.'.Jan Freiherr von Berg VD V and ba Ireturns to the reading from before Rethink the credential-run rule (S2): read a name's trailing run once, over name units, and bind it before any join #614.de Mesnil Ma do mc and Ph. D.now reports the 'do' the peel took.All five differential gates exit 0. Frames are unchanged (308 on 3.11, 289 on 3.12–3.15). The 3.12–3.15 pin was stale at 290 since #614's /simplify and is corrected here.
Found along the way
paritydidn't match 1.4.0, because they had been compared against master. Each is relabelled with the change its reading came from, found bygit bisect run(John van der Berg Vreads familyvan der Berg V— the particle chain and the maiden walk take a trailing numeral as a name word #424, Use letter case to disambiguate suffix vs. surname: "Jack MA" vs "Jack Ma" #289, Should parse("Smith, Jr.") put "Jr." in title rather than suffix? #296, ShouldJohn Smith XYZreadXYZas a credential when no wordlist has those letters? #516, Should a name word after a credential join the suffix?John Smith PhD Jonesreads middleSmith PhD#602, and R2/P2 for readings from the 2.0 pipeline). AGENTS.md now says to check parity against the wheel.test_the_second_unit_is_found_once_per_readcounts the lookups.Review history
Freiherr von Berg MA X.Y.Z.lost its suffix, andSt St VIandFreiherr St MAread the numeral or acronym as the whole family. The merged copy's exclusion list had been keeping that rule. Fixed by_weighed; AGENTS.md records the lesson (an exclusion list being replaced is a set of rules).run_start's two branches made one, and_weighedpinned to the read by an invariant (no JOINED piece is ever in the run the read takes; 320 grid names fail without it).Docs
decisions.md#S2 (#620 entry) and the parse-cost bullet; rules.md#S2 and P2's
implemented:; mechanisms.md UNIT-PARTITION and READ-WITHOUT-THEN-BIND; AGENTS.md.Test plan
uv run pytest(11,864 passed)uv run mypy,uv run ruff check🤖 Generated with Claude Code