SamanthaStorm commited on
Commit
b602114
·
verified ·
1 Parent(s): fbd7c8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -21,8 +21,8 @@ LABELS = [
21
  ]
22
 
23
  THRESHOLDS = {
24
- "blame shifting": 0.23,
25
- "contradictory statements": 0.25,
26
  "control": 0.40,
27
  "dismissiveness": 0.45,
28
  "gaslighting": 0.30,
@@ -51,7 +51,8 @@ EXPLANATIONS = {
51
  }
52
 
53
  PATTERN_WEIGHTS = {
54
- "gaslighting": 1.3, "mockery": 1.2, "control": 1.2, "dismissiveness": 0.8
 
55
  }
56
 
57
  def custom_sentiment(text):
@@ -122,8 +123,13 @@ def analyze_composite(msg1, msg2, msg3, flags):
122
  }
123
  flag_boost = sum(flag_weights.get(f, 3) for f in flags) / len(active_messages)
124
  composite_score = min(base_score + flag_boost, 100)
125
- composite_score = round(composite_score, 2)
126
- composite_score = round(composite_score)
 
 
 
 
 
127
 
128
  result = f"These messages show patterns of {', '.join(label for label, _ in top_labels)} and are estimated to be {composite_score}% likely abusive."
129
  for expl in top_explanations:
 
21
  ]
22
 
23
  THRESHOLDS = {
24
+ "blame shifting": 0.3,
25
+ "contradictory statements": 0.32,
26
  "control": 0.40,
27
  "dismissiveness": 0.45,
28
  "gaslighting": 0.30,
 
51
  }
52
 
53
  PATTERN_WEIGHTS = {
54
+ "gaslighting": 1.3, "mockery": 1.2, "control": 1.2, "dismissiveness": 0.8, "blame_shifting": 0.8,
55
+ "contradictory_statements": 0.75,
56
  }
57
 
58
  def custom_sentiment(text):
 
123
  }
124
  flag_boost = sum(flag_weights.get(f, 3) for f in flags) / len(active_messages)
125
  composite_score = min(base_score + flag_boost, 100)
126
+ # Apply message count dampening AFTER base and flag boost
127
+ if len(active_messages) == 1:
128
+ composite_score *= 0.85 # 15% reduction for 1 message
129
+ elif len(active_messages) == 2:
130
+ composite_score *= 0.93 # 7% reduction for 2 messages
131
+
132
+ composite_score = round(min(composite_score, 100), 2) # re-cap just in case
133
 
134
  result = f"These messages show patterns of {', '.join(label for label, _ in top_labels)} and are estimated to be {composite_score}% likely abusive."
135
  for expl in top_explanations: