Repository navigation
Add ParsedName.surname2, the second of two family names (3.0, 4d) - #951
Merged
Merged
Conversation
Where two_family_names (rules/O6) reads a family as two units, the one written second is the surname2 view; family keeps both, as before, and every other name has none, a family comma's and a hyphenated family included. O6 marks the unit's words with a private tag that assemble drops and carries out as Reading.second_surname, a field added with ADDED_IN and not compared, so an O6 parse still equals its 2.8.0 pickle; the RFC's stable tag would have changed ==. The view is a render key, not a field. rules/R10, decisions/R10; the agreement records score surname2 on its own, the snapshot records it where it is not empty, which under the default policy is never. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A father in the second unit is rebuilt at its marker, and nothing tested that the mark survives it (Ali Vali oglu under TR_AZ, family first): two rows now fail without it. The vocabulary-model Standing line is back in its decided wording, the amendment a dated line of its own. ParseState's ownership map names O6's tag, the docstring and the release log say which replace() empties the view, _REFUSED_SKEWS takes the new field's two rows, the role test has a test, a marked word's reading is built once, and decisions/R10 records what the switch fills where no second surname is stated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 31, 2026
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.
Sub-phase 4d of #754, the last of the views lane (4a–4d).
What it does
Where
two_family_names(rules/O6) reads a family as two name units,ParsedName.surname2holds the one written second.familykeeps both, as before.Every other name has an empty view:
Lloyd Webber, Andrew,García López, Ana);García-López,Ortega y Gasset,de la Vega Rodríguez);familywas rewritten byreplace()orrevise(). Rewriting any other field keeps the view.surname2is arender()key. It stays out ofas_dict(),--json,comparison_key()and the repr.surnamesis unchanged.A decision the spec left open: where the mark lives
The RFC planned a new stable tag in
STABLE_TAGS.Tokencompares its tags, so a published tag would make an O6 parse unequal to its own 2.8.0 pickle. This PR does what 4b and 4c did with their kind tags instead:vocab:second-surnametag on each word of the second unit.Reading.second_surnameon that word's reading. The field is new, carriesADDED_IN3.0.0 and hascompare=False, likeReading.languages.Reading('name' as 'family', 'position', second surname).tests/v2/data/parsedname_v28_two_family_names.pickle) loads equal to the 3.0 parse.The RFC's freeze table and a new dated Standing line plus a Log entry in decisions/vocabulary-model record this amendment. The decided 2026-10-28 Standing line is left as written. decisions/R10 lists the alternatives weighed:
ParsedNamefield holding the unit's start;ReadingKind, which would overwrite a particle's or patronymic's reading.Every word of the unit is marked, not only its first. Two consequences:
Ali Hassan bin Ahmad→ surname2 and patronymicbin Ahmad).Recorded as Open (decisions/R10)
surnamesits next tosurnames). The first-unit view would also carry each unit's own particles and base.Measurements (on
8a1e6f5f)Field readings. Over 1,296 parses of 36 names, tokens, tags and readings are identical to the base apart from the new field. The grid covered every order,
middle_as_familyon and off,two_family_nameson and off, and the default, RU and TR_AZ packs.Snapshot. 6,601 → 6,603 readings:
surname2;Agreement records. They gain only
surname2entries, each a stated second surname that the default does not read:With
two_family_nameson, the view agrees on:foreignFullsecond surnames are two words,González Domingo);Where no second surname is stated, the switch fills one in:
decisions/R10 has the recipe.
Frames per parse (warm,
sys.setprofilecall events):Gabriel García MárquezGabriel García MárquezJuan Pérez de la VegaGarcía Márquez GabrielA first draft cost +13 and +35 on the two O6 rows. It rebuilt each marked token at the end of assemble.
Sweeps
Each shape ran under
two_family_nameson and off, under eachname_order, and with and withoutmiddle_as_family:y, titles, suffixes and nicknames;Ali Vali ogluunder family-first). Without the fix in assemble, these rows fail.The table in
tests/v2/test_types.pykeeps a row for every shape O6 declines, so a widening of what fills the view shows up there.The rule-example grammar now accepts a digit in a field name, for
surname2. Tests cover:given2) is still refused;surname2=assertion outside a fence is still caught (this row fails against the old pattern).Docs
usage.rst, pluscustomize.rst's two-family-names section with doctests.Checks
These pass on 3.11:
uv run pytestuv run pytest -n0 -m serialuv run mypyuv run ruff checktools/vocab/build.py --checkuv run --python 3.15 pytest -qalso passes.🤖 Generated with Claude Code