Repository navigation
Read a four-character Han name opening with two surnames as a surname pair (#845) - #1127
Merged
Merged
Conversation
… pair (#845) Under locales.ZH, a four-character Han name whose first two characters are each a listed single surname, and no listed compound, now reads them as the family in two units (rules/W5): 王李小明 gives family 王李, given 小明, surname1 王, surname2 李, where it gave family 王, given 李小明. The same pair written with a space before the given name (王李 小明) reads the same way, where it gave given 李, middle 小明. The unspaced division records a SEGMENTATION report naming the longest-first reading. script_segment divides the token after both surnames and tags the second; post_rules makes it the family's second unit with the tags O6 writes, so the R10/R11 views read it unchanged. A field now joins words written with nothing between them without a space (rules/R1), so the divided family renders 王李. Measured on tw-donors: 4,864 four-character names have the shape, and for 2,076 the woman's own name is itself a donor in the same file. No committed agreement record moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The segment stage divided and reported the pair before the order was known, so a mixed-script name read given-first reported a division its reading did not take. post_rules now records the SEGMENTATION report when it reads the pair, and only for a pair written undivided. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…845) - The pair is divided only where every word of the name is Han and the name is read family-first, so a mixed-script name or a given-first Han order keeps W1's division and reads as before (Amy 王李小明, script_orders=()); a Latin title declines too, recorded as Accepted. - A spaced pair needs a word of two after the space, so a three-character name with a stray space (李林 伟, tw-donors' 廖榮 清 and 范文 豪) keeps W1's reading. - SURNAME_PAIR_TAG is stripped from published tokens. - R1's join is stated for every field but the suffix, and for any word a division cut; the release log says so. - R10/R11 Signal lines and Standing, AGENTS.md, mechanisms.md and the assemble/state comments name W5 beside O6; decisions/W5 recounts 4,868 with the parser's Han test and records the review's moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Case rows for the pair (undivided with its report, spaced, spaced with a middle, an honorific after the space, the word after the pair asked rather than the last, three characters, a stray space, a mixed-script name), and tests for a Latin word under a declared family-first order, the folded middle's join guard and a revised pair family. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The order check counted a post-nominal ending the name, which is no name piece of assign's, so 王李小明さん, 王李小明씨 and 王李小明 PhD lost the pair; it now steps over that run as the honorific peel does (fuzzed: 40,460 parses, every division read). The Latin-word test asserts the word count, since R1's join hides an extra division inside one field (recorded in mechanisms.md's field notes); Han's own order outranking a declared one is tested; W1, usage.rst and decisions/W5 name the two-character given name the spaced pair needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # nameparser/_pipeline/_assemble.py
script_segment tags a pair only where post_rules will read it, so its two declines (an order that is not family-first, a tag not right after the family) are reached only by a hand-placed tag; the test places one and holds that nothing is marked or reported. 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.
Closes #845
What changes
Under
locales.ZH, a four-character Han name whose first two characters are each a listed single surname, and not a listed compound, reads both as the family, in two units (new rule W5 (a Han surname pair)):parser_for(locales.ZH))王李小明王, given李小明王李, given小明, surname1王, surname2李(+ SEGMENTATION report naming王 + 李小明)王李 小明王, given李, middle小明王李, given小明(no report)歐陽小明,李林伟,李林 伟,王李 先生This is the married double surname (冠夫姓) Taiwan's Civil Code made the default until 1998, and the double surname some mainland children carry. Measured on the
tw-donorslocal corpus: 4,868 four-character names have the shape and all read 1 + 3 before; for 2,076 of them the woman's own name (劉碧珠beside丁劉碧珠) is itself a donor in the file. Three-character names (51,047 of the shape, 1,188 with that sign) are left alone. Details and recompute recipe:docs/design/decisions/W5-han-surname-pair.md.Decided with the proposal: the two surnames are the family's two units in the
surname1/surname2views (notmaiden), the rule applies underlocales.ZHalone, and the undivided form is reported.Scope and boundaries
script_orders=()reads exactly as before. A Latin title declines (Dr. 王李小明→ family王), recorded as Accepted in W5.李林 伟(a stray space; tw-donors' only two spaced names of the shape are this) keeps W1's reading.王李. This also rejoins any word a CJK division cut where its halves land in one field:김민준 Johngives given_names김민준where 2.1.0 – 2.8.0 gave김 민준.Docs
New rule W5 and decisions/W5; amended W1 (unspaced CJK division), R1, R10 (the second-surname view), R11 (the first-surname views) and their decisions Standing lines, root AGENTS.md, mechanisms.md (a field note: R1's join hides an extra division inside one field, so assert word counts), usage.rst, locales.rst, release log.
Review
Reviewed by four agents (design docs, code, comments, test coverage) and a second round on the fix commits. Their findings are fixed in the later commits: the split now waits for the order, the tag is stripped from published tokens, the spaced form is bounded, and the stale prose and counts are corrected. Every new guard row fails on the pre-fix code. Suite green on 3.11 (with the
jaextra) and 3.15; mypy, ruff, both Sphinx builds and the frame benchmarks pass.🤖 Generated with Claude Code