hackerbyhobby
commited on
updated scam weights
Browse files
app.py
CHANGED
@@ -34,12 +34,12 @@ def keyword_and_url_boost(probabilities, text):
|
|
34 |
found_urls = re.findall(r"(https?://[^\s]+)", lower_text)
|
35 |
url_boost = 0.0
|
36 |
if found_urls:
|
37 |
-
# For demonstration: a flat +
|
38 |
-
url_boost = 0.
|
39 |
|
40 |
# 3. Combine total boost
|
41 |
total_boost = keyword_boost + url_boost
|
42 |
-
total_boost = min(total_boost, 0.
|
43 |
|
44 |
if total_boost <= 0:
|
45 |
return probabilities # no change if no keywords/URLs found
|
@@ -50,8 +50,8 @@ def keyword_and_url_boost(probabilities, text):
|
|
50 |
|
51 |
# 4. Distribute the total boost equally to "SMiShing" and "Other Scam"
|
52 |
half_boost = total_boost / 2.0
|
53 |
-
smishing_boosted = smishing_prob +
|
54 |
-
other_scam_boosted = other_scam_prob +
|
55 |
legit_boosted = legit_prob
|
56 |
|
57 |
# 5. Re-normalize so they sum to 1
|
|
|
34 |
found_urls = re.findall(r"(https?://[^\s]+)", lower_text)
|
35 |
url_boost = 0.0
|
36 |
if found_urls:
|
37 |
+
# For demonstration: a flat +30% if a URL is found
|
38 |
+
url_boost = 0.30
|
39 |
|
40 |
# 3. Combine total boost
|
41 |
total_boost = keyword_boost + url_boost
|
42 |
+
total_boost = min(total_boost, 0.80) # cap at +80%
|
43 |
|
44 |
if total_boost <= 0:
|
45 |
return probabilities # no change if no keywords/URLs found
|
|
|
50 |
|
51 |
# 4. Distribute the total boost equally to "SMiShing" and "Other Scam"
|
52 |
half_boost = total_boost / 2.0
|
53 |
+
smishing_boosted = smishing_prob + url_boost
|
54 |
+
other_scam_boosted = other_scam_prob + keyword_boost
|
55 |
legit_boosted = legit_prob
|
56 |
|
57 |
# 5. Re-normalize so they sum to 1
|