|
76 | 76 | #: here even though the pack never ACTIVATES it: a katakana-bearing |
77 | 77 | #: token can still be a kana-licensed composite the pack acts on |
78 | 78 | #: (山田エミ) -- DEVIATES must declare it, and the adapter must not |
79 | | -#: decline it. A |
80 | | -#: pure-katakana token never reaches THE ADAPTER: KATAKANA is in no |
81 | | -#: activation set, so the stage's own gate stops it before the |
82 | | -#: segmenter is consulted. DEVIATES still declares one, and must: it |
83 | | -#: is a predicate over any name at all, called before any gate runs, |
84 | | -#: and over-declaring is its safe direction by design. |
| 79 | +#: decline it. A pure-katakana token never reaches THE ADAPTER: |
| 80 | +#: KATAKANA is in no activation set, so the stage's own gate stops it |
| 81 | +#: before the segmenter is consulted. DEVIATES still declares one, |
| 82 | +#: and must: it is a predicate over any name at all, called before |
| 83 | +#: any gate runs, and over-declaring is its safe direction by design. |
85 | 84 | _JA_SCRIPTS = (Script.HAN, Script.HIRAGANA, Script.KATAKANA) |
86 | 85 |
|
87 | 86 | # Both compiled by _policy's factory from the shared codepoint table, |
@@ -129,15 +128,13 @@ def ja_segmenter(*, gbdt: bool = False) -> Segmenter: |
129 | 128 | The adapter declines -- returns None, leaving the token whole -- |
130 | 129 | for text outside the Japanese repertoire, for text bearing the |
131 | 130 | shime mark 〆 (namedivider 0.4.x's rule path cuts it in the wrong |
132 | | - place), for text too short to divide, for any answer that fails to |
133 | | - reconstruct its input, and for |
134 | | - any score outside [0, 1] by more than float noise (a divider |
135 | | - scoring 87.0 is broken, and its division is worth no more than its |
136 | | - score). An |
137 | | - answer that puts the whole token on one side comes back as |
138 | | - "confidently one token" rather than a decline: the divider read it |
139 | | - and found nothing to cut, which is not the same as having no |
140 | | - opinion. |
| 131 | + place), for text too short to divide, for any answer that fails |
| 132 | + to reconstruct its input, and for any score outside [0, 1] by |
| 133 | + more than float noise (a divider scoring 87.0 is broken, and its |
| 134 | + division is worth no more than its score). An answer that puts |
| 135 | + the whole token on one side comes back as "confidently one token" |
| 136 | + rather than a decline: the divider read it and found nothing to |
| 137 | + cut, which is not the same as having no opinion. |
141 | 138 | Answers arrive with namedivider's own confidence, which the parsing |
142 | 139 | stage compares against its floor to decide whether to report a |
143 | 140 | SEGMENTATION ambiguity: namedivider scores a rule-based division |
@@ -176,7 +173,12 @@ def segment(text: str) -> Segmentation | None: |
176 | 173 | # 〆野), so a wrong family would arrive with no SEGMENTATION |
177 | 174 | # report. Decline instead: the family-first ORDER fix for 〆 |
178 | 175 | # stands regardless, and division can return when a divider |
179 | | - # knows the mark. |
| 176 | + # knows the mark. The blanket check is deliberately broader |
| 177 | + # than that rule-path failure: mid-token 〆 (山〆太郎) comes |
| 178 | + # back 山 | 〆太郎 at 0.375 on the kanji_feature path |
| 179 | + # (measured), a low-confidence answer that WOULD have carried |
| 180 | + # a SEGMENTATION report -- swept in anyway, because decline is |
| 181 | + # the safe direction and mid-token 〆 is vanishingly rare. |
180 | 182 | if "〆" in text: |
181 | 183 | return None |
182 | 184 | # namedivider RAISES below two characters ("Name length needs |
|
0 commit comments