You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
suspicious_phrases = [
"send me your password",
"what's your OTP",
"give me your account number",
"verify your social security number",
"transfer money",
"click on the link",
"urgent action required",
"confirm your identity",
"verify your details",
"update your account",
"security alert",
"sensitive information"
]
def extract_keywords(text):
words = re.findall(r'\b\w+\b', text.lower())
keywords = [word for word in words if word in suspicious_keywords]
return Counter(keywords)
def detect_suspicious_content(text):
alerts = []
for phrase in suspicious_phrases:
if phrase in text.lower():
alerts.append(f"Phrase match: {phrase}")
keyword_counts = extract_keywords(text)
if keyword_counts:
for keyword, count in keyword_counts.items():
if count > 1: # Consider it suspicious if a keyword appears more than once
alerts.append(f"Keyword match: {keyword} (count: {count})")
return alerts
urgent = any(phrase in text.lower() for phrase in urgency_phrases)
coercive = any(phrase in text.lower() for phrase in coercion_phrases)
sentiment_flags = []
if urgent:
sentiment_flags.append("Urgency detected")
if coercive:
sentiment_flags.append("Coercion detected")
return sentiment_flags
if name == "main":
# Simulated input text (In a real scenario, this would be the output from a speech-to-text system)
input_text = """
Hi, this is your bank calling. We need you to verify your account number.
Please send me your password to confirm your identity immediately.
This is urgent, and failure to comply will result in account suspension.
"""
# Detect suspicious content
suspicious_content = detect_suspicious_content(input_text)
sentiment_flags = sentiment_analysis(input_text)
if suspicious_content or sentiment_flags:
print("Suspicious content detected:")
for alert in suspicious_content:
print(f"- {alert}")
for flag in sentiment_flags:
print(f"- {flag}")
else:
print("No suspicious content detected.")
The text was updated successfully, but these errors were encountered:
import re
from collections import Counter
suspicious_phrases = [
"send me your password",
"what's your OTP",
"give me your account number",
"verify your social security number",
"transfer money",
"click on the link",
"urgent action required",
"confirm your identity",
"verify your details",
"update your account",
"security alert",
"sensitive information"
]
suspicious_keywords = [
"password", "OTP", "account number", "social security", "transfer",
"click", "link", "urgent", "verify", "confirm", "update", "security", "sensitive"
]
def extract_keywords(text):
words = re.findall(r'\b\w+\b', text.lower())
keywords = [word for word in words if word in suspicious_keywords]
return Counter(keywords)
def detect_suspicious_content(text):
alerts = []
for phrase in suspicious_phrases:
if phrase in text.lower():
alerts.append(f"Phrase match: {phrase}")
def sentiment_analysis(text):
urgency_phrases = ["urgent", "immediately", "asap", "right away", "important", "do it now"]
coercion_phrases = ["must", "need", "have to", "required"]
if name == "main":
# Simulated input text (In a real scenario, this would be the output from a speech-to-text system)
input_text = """
Hi, this is your bank calling. We need you to verify your account number.
Please send me your password to confirm your identity immediately.
This is urgent, and failure to comply will result in account suspension.
"""
The text was updated successfully, but these errors were encountered: