Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -334,14 +334,12 @@ def compute_abuse_score(matched_scores, sentiment):
|
|
334 |
return min(adjusted_score, 100)
|
335 |
def analyze_single_message(text, thresholds):
|
336 |
motif_hits, matched_phrases = detect_motifs(text)
|
337 |
-
|
338 |
|
339 |
# Derive sentiment from emotion intensity
|
340 |
-
|
341 |
sentiment_score = emotion_profile.get("anger", 0) + emotion_profile.get("disgust", 0)
|
342 |
sentiment = "undermining" if sentiment_score > 0.4 else "supportive"
|
343 |
-
|
344 |
-
print(f"Emotional Tone Tag: {tone_tag}")
|
345 |
weapon_flag = detect_weapon_language(text)
|
346 |
|
347 |
adjusted_thresholds = {
|
@@ -395,6 +393,10 @@ def analyze_single_message(text, thresholds):
|
|
395 |
|
396 |
abuse_score = min(abuse_score_raw, 100 if "threat" in threshold_labels or "control" in threshold_labels else 95)
|
397 |
|
|
|
|
|
|
|
|
|
398 |
# Debug logging
|
399 |
print("Emotion Profile:")
|
400 |
for emotion, score in emotion_profile.items():
|
|
|
334 |
return min(adjusted_score, 100)
|
335 |
def analyze_single_message(text, thresholds):
|
336 |
motif_hits, matched_phrases = detect_motifs(text)
|
|
|
337 |
|
338 |
# Derive sentiment from emotion intensity
|
339 |
+
emotion_profile = get_emotion_profile(text)
|
340 |
sentiment_score = emotion_profile.get("anger", 0) + emotion_profile.get("disgust", 0)
|
341 |
sentiment = "undermining" if sentiment_score > 0.4 else "supportive"
|
342 |
+
|
|
|
343 |
weapon_flag = detect_weapon_language(text)
|
344 |
|
345 |
adjusted_thresholds = {
|
|
|
393 |
|
394 |
abuse_score = min(abuse_score_raw, 100 if "threat" in threshold_labels or "control" in threshold_labels else 95)
|
395 |
|
396 |
+
# Now that abuse_score is ready → get tone tag
|
397 |
+
tone_tag = get_emotional_tone_tag(emotion_profile, sentiment, threshold_labels, abuse_score)
|
398 |
+
print(f"Emotional Tone Tag: {tone_tag}")
|
399 |
+
|
400 |
# Debug logging
|
401 |
print("Emotion Profile:")
|
402 |
for emotion, score in emotion_profile.items():
|