Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
635 |
composite_abuse_scores = []
|
636 |
|
637 |
for result, _ in results:
|
638 |
-
|
639 |
-
|
640 |
-
|
|
|
|
|
|
|
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)
|