|
37 | 37 | # per-char on the _EMOJI_RANGES precedent in _tokenize.py, on the |
38 | 38 | # theory that a range test needs no regex; measured at token scale the |
39 | 39 | # compiled regex wins by 3-9x, and by 89x on long tokens.) |
40 | | -# HAN: the URO plus Extension A, the compatibility block, |
41 | | -# and the supplementary-plane block (Ext B-I + CJK Compat Ideographs |
42 | | -# Supplement, 0x20000-0x323AF) -- rare surnames are the biggest real |
43 | | -# source of supplementary-plane hanzi in personal names (e.g. 𠮷田's |
44 | | -# 𠮷, U+20BB7), so leaving them out silently mis-orders those names; |
45 | | -# unassigned gaps inside the span are harmless, since no real name |
46 | | -# contains an unassigned codepoint. HANGUL: precomposed syllables |
47 | | -# only -- modern Korean text never writes names as bare jamo. |
| 40 | +# HAN: the ideographic iteration mark U+3005, the URO plus Extension |
| 41 | +# A, the compatibility block, and the supplementary-plane block |
| 42 | +# (Ext B-I + CJK Compat Ideographs Supplement, 0x20000-0x323AF) -- |
| 43 | +# rare surnames are the biggest real source of supplementary-plane |
| 44 | +# hanzi in personal names (e.g. 𠮷田's 𠮷, U+20BB7), so leaving them |
| 45 | +# out silently mis-orders those names; unassigned gaps inside the span |
| 46 | +# are harmless, since no real name contains an unassigned codepoint. |
| 47 | +# U+3005 々 is the block-vs-Script case again (it is Script=Common |
| 48 | +# under UAX #24, like U+30FB below): it REPEATS the preceding kanji |
| 49 | +# and appears only inside Han-written names -- 佐々木 (Sasaki, a |
| 50 | +# top-20 Japanese surname), 野々村, 奈々 -- so a token carrying it is |
| 51 | +# as Han as the character it iterates. Omitting it made 佐々木 a |
| 52 | +# mixed-script token: the name reversed and never gated into |
| 53 | +# segmentation. HANGUL: precomposed syllables only -- modern Korean |
| 54 | +# text never writes names as bare jamo. |
48 | 55 | # HIRAGANA/KATAKANA (#272): the two kana blocks, each in full. There |
49 | 56 | # IS a supplementary-plane kana repertoire (Kana Supplement, Kana |
50 | 57 | # Extended-A/B, Small Kana Extension, U+1AFF0-U+1B16F, 311 assigned |
|
75 | 82 | # (dict iteration order), so an overlapping future script would make |
76 | 83 | # the result order-dependent instead of well-defined. |
77 | 84 | _SCRIPT_RANGES: dict[Script, tuple[tuple[int, int], ...]] = { |
78 | | - Script.HAN: ((0x3400, 0x4DBF), (0x4E00, 0x9FFF), (0xF900, 0xFAFF), |
79 | | - (0x20000, 0x323AF)), |
| 85 | + Script.HAN: ((0x3005, 0x3005), (0x3400, 0x4DBF), (0x4E00, 0x9FFF), |
| 86 | + (0xF900, 0xFAFF), (0x20000, 0x323AF)), |
80 | 87 | Script.HANGUL: ((0xAC00, 0xD7A3),), |
81 | 88 | Script.HIRAGANA: ((0x3040, 0x309F),), |
82 | 89 | Script.KATAKANA: ((0x30A0, 0x30FF),), |
|
0 commit comments