SamanthaStorm commited on
Commit
d374438
·
verified ·
1 Parent(s): 44ac58a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -458,7 +458,7 @@ def analyze_single_message(text, thresholds):
458
  label for label, score in zip(LABELS, scores)
459
  if score > adjusted_thresholds[label]
460
  ]
461
-
462
  motifs = [phrase for _, phrase in matched_phrases]
463
 
464
  darvo_score = calculate_darvo_score(
@@ -474,6 +474,11 @@ def analyze_single_message(text, thresholds):
474
  key=lambda x: x[1],
475
  reverse=True
476
  )[:2]
 
 
 
 
 
477
 
478
  matched_scores = [
479
  (label, score, PATTERN_WEIGHTS.get(label, 1.0))
@@ -497,7 +502,7 @@ def analyze_single_message(text, thresholds):
497
  )
498
 
499
  # Tone tag must happen after abuse_score is finalized
500
- tone_tag = get_emotional_tone_tag(emotion_profile, sentiment, threshold_labels, abuse_score)
501
 
502
  # Debug
503
  print(f"Emotional Tone Tag: {tone_tag}")
 
458
  label for label, score in zip(LABELS, scores)
459
  if score > adjusted_thresholds[label]
460
  ]
461
+ tone_tag = get_emotional_tone_tag(emotion_profile, sentiment, threshold_labels, 0)
462
  motifs = [phrase for _, phrase in matched_phrases]
463
 
464
  darvo_score = calculate_darvo_score(
 
474
  key=lambda x: x[1],
475
  reverse=True
476
  )[:2]
477
+ # Post-threshold validation: strip recovery if it occurs with undermining sentiment
478
+ if "recovery" in threshold_labels and tone_tag == "forced accountability flip":
479
+ threshold_labels.remove("recovery")
480
+ top_patterns = [p for p in top_patterns if p[0] != "recovery"]
481
+ print("⚠️ Removing 'recovery' due to undermining sentiment (not genuine repair)")
482
 
483
  matched_scores = [
484
  (label, score, PATTERN_WEIGHTS.get(label, 1.0))
 
502
  )
503
 
504
  # Tone tag must happen after abuse_score is finalized
505
+ tone_tag = get_emotional_tone_tag(emotion_profile, sentiment, threshold_labels, abuse_score
506
 
507
  # Debug
508
  print(f"Emotional Tone Tag: {tone_tag}")