SamanthaStorm commited on
Commit
967ce44
·
verified ·
1 Parent(s): 5ee6178

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -631,13 +631,16 @@ def analyze_composite(msg1, date1, msg2, date2, msg3, date3, *answers_and_none):
631
  for result, date in results:
632
  assert len(result) == 7, "Unexpected output from analyze_single_message"
633
 
634
- # --- Composite Abuse Score with Weighted Patterns ---
635
  composite_abuse_scores = []
636
 
637
  for result, _ in results:
638
- abuse_score, threshold_labels, top_patterns, _, _, _, _ = result
639
- weighted_score = 0
640
- total_weight = 0
 
 
 
641
 
642
  for label, score in top_patterns:
643
  weight = PATTERN_WEIGHTS.get(label, 1.0)
 
631
  for result, date in results:
632
  assert len(result) == 7, "Unexpected output from analyze_single_message"
633
 
634
+ # --- Composite Abuse Score using compute_abuse_score ---
635
  composite_abuse_scores = []
636
 
637
  for result, _ in results:
638
+ _, _, top_patterns, sentiment, _, _, _ = result
639
+ matched_scores = [(label, score, PATTERN_WEIGHTS.get(label, 1.0)) for label, score in top_patterns]
640
+ final_score = compute_abuse_score(matched_scores, sentiment["label"])
641
+ composite_abuse_scores.append(final_score)
642
+
643
+ composite_abuse = int(round(sum(composite_abuse_scores) / len(composite_abuse_scores)))
644
 
645
  for label, score in top_patterns:
646
  weight = PATTERN_WEIGHTS.get(label, 1.0)