Skip to content

Recognize spaced CJK postnominal honorifics as suffixes - #310

Merged
derek73 merged 2 commits into
masterfrom
v2.1/cjk-honorifics
Jul 31, 2026
Merged

Recognize spaced CJK postnominal honorifics as suffixes#310
derek73 merged 2 commits into
masterfrom
v2.1/cjk-honorifics

Conversation

@derek73

@derek73 derek73 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #307. Thirteen curated CJK honorifics and degrees join SUFFIX_NOT_ACRONYMS (beside the Hebrew post-nominal block, vetted per the file's мл/ст standard): Korean 씨/박사/선생님/교수님/군/양 — standardly spaced in Korean orthography, the strongest case — Chinese 先生/女士/小姐/博士/教授, Japanese 様/氏, with the shared-Han 先生/博士/教授 serving both languages. Under the 2.1 family-first defaults an unrecognized honorific confidently became a name part (王小明 先生 → given=先生); now it routes to suffix and the remaining name takes its normal reading. Entries are self-selecting — Han/hangul vocabulary can only match CJK text — so no script conditioning is involved. No mechanism changes: suffix classification already runs after segmentation and before the positional read.

Review upgraded the scope in the good direction: glued hangul honorifics are reached too — default segmentation splits 김씨 into 김 + 씨 before the suffix is classified, a partial delivery of #308 that falls out of stage order (glued Han needs locales.ZH the same way; glued kana stays #308). Docs state it and case rows pin the glued and post-comma shapes alongside the spaced ones. The position gate protects surname-position collisions: 양 미선 keeps 양 as the family name.

Differential: a new fix(cjk-honorific-suffix) rule takes the compound diffs, keyed on the honorific alternation (maiden-marker precedent) and anchored to a whole trailing token so a genuine given name ending in 양/군 can never have a regression absorbed; a sync test derives the expected alternation from the config by script membership. Harness: 698 names, 56 intentional, 0 unexplained.

Test plan

  • Six case rows (spaced ×4, glued-via-segmentation, post-comma) through core and facade runners
  • Full suite 2715 passed; mypy, ruff, sphinx html + doctest clean
  • Differential harness vs pinned 1.4: 698/56/0 with the new rule claiming its four
  • Adversarial probes: leading honorifics stay name parts, lone 양/군 stay names, 氏-initial surnames unaffected, per-instance Constants removal restores old behavior

🤖 Generated with Claude Code

CJK honorifics and degrees FOLLOW the name, and under the 2.1
family-first defaults an unrecognized one confidently became a name
part: 王小明 先生 read given=先生, 김민준 씨 put the honorific in
middle. Thirteen curated entries join SUFFIX_NOT_ACRONYMS beside the
Hebrew post-nominal block -- ko 씨/박사/선생님/교수님/군/양 (standardly
spaced in Korean orthography, the strongest case), zh
先生/女士/小姐/博士/教授, ja 様/氏, with 先生/博士/教授 shared Han
serving both languages. Self-selecting like the Korean surnames: a
Han or hangul entry can only ever match CJK text. Vetted per the
file's мл/ст standard; 氏 and the ko single-syllable pair 군/양 are
argued in the comment, and the trailing-only position gate keeps
surname-position 양 (양 미선) untouched.

The order interaction needed no mechanism: suffix classification runs
after script_segment and before the positional read, so the rows pass
on vocabulary alone, through both the core and facade runners.

Review found the scope claim wrong in the good direction: glued
HANGUL honorifics are reached too, because default segmentation
splits 김씨 into 김 + 씨 before suffix classification -- a partial
delivery of #308 that falls out of stage order (glued Han needs the
zh pack the same way; glued kana stays #308). Docs and the config
comment state it, and case rows pin the glued and post-comma shapes
alongside the four spaced ones.

Differential: the new fix(cjk-honorific-suffix) rule takes the
compound diffs (honorific recognition x CJK flip), keyed on the
honorific alternation per the maiden-marker precedent and anchored
to a WHOLE trailing token -- a glued ending must not match, or a
genuine given name ending in 양/군 could have a real regression
absorbed. The alternation is a hand copy of the config's CJK
entries, pinned by a sync test that DERIVES the expected set from
SUFFIX_NOT_ACRONYMS by script membership. Glued-hangul diffs fall to
fields-only suffix-routing by their shape, noted in the rule.
Harness: 698 names, 56 intentional, 0 unexplained.

Closes #307

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.45%. Comparing base (d09ac7f) to head (4ebb4c4).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #310   +/-   ##
=======================================
  Coverage   98.45%   98.45%           
=======================================
  Files          41       41           
  Lines        2776     2776           
=======================================
  Hits         2733     2733           
  Misses         43       43           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@derek73 derek73 self-assigned this Jul 31, 2026
@derek73 derek73 added this to the v2.1 milestone Jul 31, 2026
…claims

The PR review's convergent finding: 'glued hangul is reached' was
overbroad in four places. Segmentation splits off ONE leading
surname, so a glued honorific is reached in exactly the
surname+honorific shape (김씨, 王先生 under zh) -- a glued honorific
after a GIVEN name (김민준씨, 王小明先生), the more common written
form, stays out of reach and belongs to #308. Every surface now
states the boundary, and six new case rows pin it and the other
prose-only claims: the two glued contrast pairs, whole-token
matching (김지양 -- 지양 ENDS with 양 and must not peel, the
parser-side twin of the differential anchor), surname-position 양
(양 미선 keeps family Yang), and the trailing honorific run
(김민준 박사 씨 peels both, the Latin multi-suffix loop).

The vetting comment gains its third named entry -- 博士 is an
attested Japanese given name (ひろし, Hiroshi), argued rather than
omitted -- plus the 양-surname overlap the 씨 argument covered only
implicitly, and a sentence recording why bare hangul 선생/교수
deliberately do not ship. The differential rule comment corrects
the 김씨 diff shape ({first, last, suffix}: v1 held the whole token
in first, so last moves too), states the mixed-Latin shadow
('Wang Xiaoming 先生') as accepted rather than denied, and explains
the anchor at the name-string level where it actually operates. The
release log recovers the shared-Han fact (先生/博士/教授 serve
Japanese too).

Harness: 704 names, 62 intentional, 0 unexplained.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@derek73
derek73 merged commit 427c01e into master Jul 31, 2026
11 checks passed
@derek73
derek73 deleted the v2.1/cjk-honorifics branch July 31, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spaced CJK honorifics parse as name parts (王小明 先生 → given 先生)

1 participant