This commit is contained in:
2026-09-27 00:41:00 +08:00
parent e87cb869ba
commit 2d4f9230b1
119 changed files with 28773 additions and 28616 deletions
+35 -35
View File
@@ -1,35 +1,35 @@
from __future__ import annotations
TIMES_OF_DAY = ["morning", "afternoon", "evening"]
VALID_EMOTIONAL_STATES = [
"calm", "content", "curious", "satisfied", "hopeful",
"restless", "frustrated", "dissatisfied", "uneasy", "anxious",
"angry", "fearful", "hostile", "desperate",
"conflicted", "torn", "confused",
]
def normalize_emotional_state(raw: str) -> str:
if not raw:
return "calm"
lower = raw.lower().strip()
for state in VALID_EMOTIONAL_STATES:
if state in lower:
return state
if any(w in lower for w in ("happy", "joy", "pleased", "glad", "happiness")):
return "content"
if any(w in lower for w in ("worry", "nervous", "uncertain", "anxiety", "anxiet")):
return "anxious"
if any(w in lower for w in ("sad", "sorrow", "grief", "mourn")):
return "dissatisfied"
if any(w in lower for w in ("rage", "fury", "furious", "outraged")):
return "angry"
if any(w in lower for w in ("scared", "terrified", "afraid")):
return "fearful"
if any(w in lower for w in ("bored", "tired", "weary")):
return "restless"
if any(w in lower for w in ("excited", "eager", "enthusiastic")):
return "hopeful"
if any(w in lower for w in ("suspicious", "wary", "distrustful")):
return "uneasy"
return "calm"
from __future__ import annotations
TIMES_OF_DAY = ["morning", "afternoon", "evening"]
VALID_EMOTIONAL_STATES = [
"calm", "content", "curious", "satisfied", "hopeful",
"restless", "frustrated", "dissatisfied", "uneasy", "anxious",
"angry", "fearful", "hostile", "desperate",
"conflicted", "torn", "confused",
]
def normalize_emotional_state(raw: str) -> str:
if not raw:
return "calm"
lower = raw.lower().strip()
for state in VALID_EMOTIONAL_STATES:
if state in lower:
return state
if any(w in lower for w in ("happy", "joy", "pleased", "glad", "happiness")):
return "content"
if any(w in lower for w in ("worry", "nervous", "uncertain", "anxiety", "anxiet")):
return "anxious"
if any(w in lower for w in ("sad", "sorrow", "grief", "mourn")):
return "dissatisfied"
if any(w in lower for w in ("rage", "fury", "furious", "outraged")):
return "angry"
if any(w in lower for w in ("scared", "terrified", "afraid")):
return "fearful"
if any(w in lower for w in ("bored", "tired", "weary")):
return "restless"
if any(w in lower for w in ("excited", "eager", "enthusiastic")):
return "hopeful"
if any(w in lower for w in ("suspicious", "wary", "distrustful")):
return "uneasy"
return "calm"