Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -170,9 +170,6 @@ def get_emotional_tone_tag(emotions, sentiment, patterns, abuse_score):
|
|
| 170 |
anger = emotions.get("anger", 0)
|
| 171 |
fear = emotions.get("fear", 0)
|
| 172 |
disgust = emotions.get("disgust", 0)
|
| 173 |
-
deflection = patterns.get("deflection", 0)
|
| 174 |
-
projection = patterns.get("projection", 0)
|
| 175 |
-
aggression = patterns.get("aggression", 0)
|
| 176 |
|
| 177 |
# 1. Performative Regret
|
| 178 |
if (
|
|
@@ -229,15 +226,20 @@ def get_emotional_tone_tag(emotions, sentiment, patterns, abuse_score):
|
|
| 229 |
sentiment == "undermining"
|
| 230 |
):
|
| 231 |
return "toxic resignation"
|
|
|
|
| 232 |
if (
|
| 233 |
-
|
|
|
|
|
|
|
| 234 |
):
|
| 235 |
-
return "aggressive"
|
|
|
|
| 236 |
if (
|
| 237 |
-
(
|
| 238 |
-
(
|
|
|
|
| 239 |
):
|
| 240 |
-
return "deflective"
|
| 241 |
|
| 242 |
return None
|
| 243 |
def detect_contradiction(message):
|
|
|
|
| 170 |
anger = emotions.get("anger", 0)
|
| 171 |
fear = emotions.get("fear", 0)
|
| 172 |
disgust = emotions.get("disgust", 0)
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
# 1. Performative Regret
|
| 175 |
if (
|
|
|
|
| 226 |
sentiment == "undermining"
|
| 227 |
):
|
| 228 |
return "toxic resignation"
|
| 229 |
+
# 8. Aggressive Dismissal
|
| 230 |
if (
|
| 231 |
+
anger > 0.5 and
|
| 232 |
+
any(p in patterns for p in ["aggression", "insults", "control"]) and
|
| 233 |
+
sentiment == "undermining"
|
| 234 |
):
|
| 235 |
+
return "aggressive dismissal"
|
| 236 |
+
# 9. Deflective Hostility
|
| 237 |
if (
|
| 238 |
+
(0.2 < anger < 0.7 or 0.2 < disgust < 0.7) and
|
| 239 |
+
any(p in patterns for p in ["deflection", "projection"]) and
|
| 240 |
+
sentiment == "undermining"
|
| 241 |
):
|
| 242 |
+
return "deflective hostility"
|
| 243 |
|
| 244 |
return None
|
| 245 |
def detect_contradiction(message):
|