Skip to content

Commit 64031f7

Browse files
wehosclaude
andcommitted
style: docstring 禁 CJK 门禁 —— 两处例子挪进注释
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 4fccbf7 commit 64031f7

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

main_routers/system_router/emotion.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,11 @@ def _strip_negation_blocklist(text):
195195
"""Drop the words that merely *contain* a negation character.
196196
197197
Removed rather than blanked: both callers compare against the end of a
198-
fixed-width window, so leaving spaces behind pushes a real negation out of
199-
it -- `別特別開心` would become `別 ` and read as un-negated.
198+
fixed-width window, so leaving spaces behind would push a real negation out
199+
of that window and the phrase would read as un-negated.
200200
"""
201+
# e.g. `別特別開心` -- blanking would leave `別 `, which ends in whitespace
202+
# rather than in the negation that is actually there.
201203
for phrase in _HEURISTIC_NEGATION_BLOCKLIST:
202204
if phrase and phrase in text:
203205
text = text.replace(phrase, '')
@@ -219,12 +221,14 @@ def _alias_after(compact_text, position):
219221
def _marker_attaches_to_head(head):
220222
"""Whether a postposed negation is denying the emotion word right before it.
221223
222-
`難過哭不出來` is sad: the marker denies the crying, and the sadness is the
223-
reason. The fuzzy test alone read the whole of `難過哭` as one misspelt
224-
emotion word and answered the opposite. So when the head does contain an
225-
emotion word, that word has to be the thing the marker sits against; a head
226-
with none is still handed to the fuzzy test, which is what it was for.
224+
"so sad I can't even cry" is sad: the marker denies the crying, and the
225+
sadness is the reason it is being mentioned. The fuzzy test alone read the
226+
whole run before the marker as one misspelt emotion word and answered the
227+
opposite. So when the head does contain an emotion word, that word has to be
228+
the thing the marker sits against; a head with none is still handed to the
229+
fuzzy test, which is what it was for.
227230
"""
231+
# 上面那句对应的是 `難過哭不出來`,`不出來` 否定的是 `哭` 不是 `難過`。
228232
present = [alias for alias in _EMOTION_COMPACT_ALIAS_LOOKUP if alias and alias in head]
229233
return any(head.endswith(alias) for alias in present) if present else True
230234

0 commit comments

Comments
 (0)