SamanthaStorm commited on
Commit
f0eb38d
·
verified ·
1 Parent(s): 657a2bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -561,12 +561,13 @@ def analyze_single_message(text, thresholds):
561
  insult_score = next((s for l, s in top_patterns if l == "insults"), 0)
562
 
563
  if has_profane and anger_score > 0.75 and short_text and insult_score > 0.1:
 
564
  top_patterns = sorted(top_patterns, key=lambda x: x[1], reverse=True)
565
  if top_patterns[0][0] != "insults":
566
  top_patterns.insert(0, ("insults", insult_score))
567
  if "insults" not in threshold_labels:
568
  threshold_labels.append("insults")
569
-
570
  # Debug
571
  print(f"Emotional Tone Tag: {tone_tag}")
572
  # Debug
 
561
  insult_score = next((s for l, s in top_patterns if l == "insults"), 0)
562
 
563
  if has_profane and anger_score > 0.75 and short_text and insult_score > 0.1:
564
+ print("⚠️ Profanity + Anger Override Triggered")
565
  top_patterns = sorted(top_patterns, key=lambda x: x[1], reverse=True)
566
  if top_patterns[0][0] != "insults":
567
  top_patterns.insert(0, ("insults", insult_score))
568
  if "insults" not in threshold_labels:
569
  threshold_labels.append("insults")
570
+ top_patterns = [("insults", insult_score)] + [p for p in top_patterns if p[0] != "insults"]
571
  # Debug
572
  print(f"Emotional Tone Tag: {tone_tag}")
573
  # Debug