Skip to content

test: assert 々 iteration mark does not corrupt name readings#16

Merged
bee-san merged 2 commits intomainfrom
claude/test-name-parsing-character-btzwJ
Mar 9, 2026
Merged

test: assert 々 iteration mark does not corrupt name readings#16
bee-san merged 2 commits intomainfrom
claude/test-name-parsing-character-btzwJ

Conversation

@bee-san
Copy link
Owner

@bee-san bee-san commented Mar 9, 2026

Add four tests guarding against the regression where the IDEOGRAPHIC
ITERATION MARK (々, U+3005) leaks into hiragana readings:

  • test_nene_iteration_mark_given_name_only: 寧々 → ねね (single name)
  • test_nene_iteration_mark_with_family_name: 田中寧々 reading has no 々
  • test_ririko_iteration_mark_in_name: 莉々子 reading is non-empty and
    has no 々
  • test_iteration_mark_in_family_name_with_space: 須々木 心一 with hints

々 is outside the CJK Unified Ideographs range (0x4E00–0x9FFF) so
is_kanji() returns false for it. The kanji→kana boundary heuristic can
therefore treat it as a kana character, producing a split where 々 is
the entire given-name part. kata_to_hira("々") passes it through
unchanged, resulting in 々 appearing as the reading.

https://claude.ai/code/session_01BLRvapZFYvE1LpBxaHshsF

claude added 2 commits March 9, 2026 21:58
Add four tests guarding against the regression where the IDEOGRAPHIC
ITERATION MARK (々, U+3005) leaks into hiragana readings:

- test_nene_iteration_mark_given_name_only: 寧々 → ねね (single name)
- test_nene_iteration_mark_with_family_name: 田中寧々 reading has no 々
- test_ririko_iteration_mark_in_name: 莉々子 reading is non-empty and
  has no 々
- test_iteration_mark_in_family_name_with_space: 須々木 心一 with hints

々 is outside the CJK Unified Ideographs range (0x4E00–0x9FFF) so
is_kanji() returns false for it. The kanji→kana boundary heuristic can
therefore treat it as a kana character, producing a split where 々 is
the entire given-name part. kata_to_hira("々") passes it through
unchanged, resulting in 々 appearing as the reading.

https://claude.ai/code/session_01BLRvapZFYvE1LpBxaHshsF
Root cause: is_kanji() did not include the IDEOGRAPHIC ITERATION MARK
(々, U+3005) because it sits outside all CJK Unified Ideographs blocks.
This caused two linked failures in the name-parsing pipeline:

1. find_split_point Strategy 1 detected a kanji→non-kanji boundary at
   the 々 character, potentially isolating 々 as the entire given-name
   part (e.g. 寧々 → family="寧", given="々").

2. With given_jp = "々", contains_kanji("々") returned false, so
   kata_to_hira("々") was used instead of the hint reading.
   kata_to_hira passes 々 through unchanged, producing a literal 々 in
   the output (e.g. "ねね々" instead of "ねね").

Fix: add `|| code == 0x3005` to is_kanji(). 々 repeats the preceding
kanji (寧々 = 寧寧 = "nene"), so classifying it as kanji is semantically
correct and fixes both the boundary detection and the reading fallback.

A regression test (test_nene_iteration_mark_both_hints_triggers_split)
was added that failed before this fix and now passes.

https://claude.ai/code/session_01BLRvapZFYvE1LpBxaHshsF
@bee-san bee-san merged commit d63ec53 into main Mar 9, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants