Repository navigation
Name an alternative's field through one slot and one name-piece helper (#752) - #905
Merged
Merged
Conversation
#752) The code naming Ambiguity.alternative's field (phase 2m, #902) grew across three review rounds into five helpers that each re-derived part of one question. _slot_field now answers which field a name slot takes by structure (the family before a family comma, the given part's given or middle name after one, the order's otherwise) for as_a_name, _split_name_alt and _resolve_deferred, and _name_pieces lists a segment's name pieces for those two and post_rules' _unattached. Deferred.BESIDE and PendingReading's beside/unfolded fields, which meant something only under it, become a Beside(index, unfolded) variant of the role. No alternative moves: a record of every report's kind and alternative over 542,555 parses (the case table under three orders, the review shapes, the snapshot corpora under six policies, a generated grid of one- to three-word runs in nine comma shapes) is identical before and after, and a mutation planted in _slot_field moves 198 of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A follow-up to #902 (phase 2m of #752). Over three review rounds, the code that names
Ambiguity.alternative's field grew into five helpers that each re-derived part of one question: where would this word land as a name word? This PR merges what they shared and givesPendingReading's BESIDE-only data its own type. No reading or alternative moves.What changes
_assign._slot_field(state, seg_idx, pos, count, order)answers which field a name slot takes, by structure:as_a_name,_split_name_altand_resolve_deferredeach had their own copy of this; they now call it._assign._name_pieces(state, tokens, seg_idx)lists a segment's name pieces, for_split_name_alt,_resolve_deferredand_post_rules._unattached.Beside(index, unfolded)in_pipeline/_state.pyreplacesDeferred.BESIDEand the two optionalPendingReadingfieldsbesideandunfolded, which meant something only under it.PendingReading.roleis nowRole | Deferred | Beside, and_assemble._alternativereads the variant._name_alt's parameterfamily_fixedis renamedlicensed. It is P5's (bound given names) join licence, which a given-name title grants as well as a family comma.Left alone, as scoped: the snapshot and compare tooling, and
as_a_middleand the P6 report site in the given-part walk. Those two look up the piece in front by raw index, which is a different question from_name_pieces. They already name the middle slot_slot_fieldwould give them there.Measurements (2026-10-26)
No alternative moves. I recorded every report's kind and alternative (reading kind, role, source) over 542,555 parses, before the change and after. The grid:
_REVIEW_SHAPES;middle_as_familywith and without FAMILY_FIRST, andtwo_family_names);Of 234,112 reports, 232,739 carry an alternative, and the two records are identical. Negative control: with the given part's first slot mutated in
_slot_field, the same record moves 198.Snapshot and local corpora. The committed snapshot matches.
snapshot.py --local tse-donorsand--local ctgov-officialswith--basemaster match with alternatives compared, since both sides' headers record them.Frames. The reference row keeps 305 and
Smith, John158, and the serial benchmark passes. A name that reports pays one frame per_slot_fieldcall, and a connective's report one more for_name_pieces:JOHN SMITH MA223 → 224,MARIA DA SILVA E SOUZA294 → 296. The cost is per report, not per token, and no guard moves.Checks.
uv run pytestpasses (31,529), as do the serial suite, Python 3.15, mypy, ruff, the sphinx doctest build and the README doctest.Review. The code review found no defects. It flagged two lines the refactor left unwrapped, fixed in 80f64af. A second review checked that commit and found it is wrapping only.
Refs #752.
🤖 Generated with Claude Code