| import re | |
| def is_spam(message): | |
| spam_keywords = ["๋ฌด๋ฃ", "์์ต", "๊ด๊ณ ", "์ฆ.๊ถ", "์๋ด", "๊ธ์ผ๋ถํฐ", "์ต๊ณ ๊ธ", "๊ฐ์", "๊ต์ก", "์๋ฃ", "์ ๋ฆฝ๊ธ", "ํ๋ฅ ", "์ธ๊ณ", "๋น๋ฐ๋ฒํธ", "์ถ์ฒ", "๋จ์ฒด๋ฐฉ", "์คํ", "์์ต๋ฅ ", "๋งค๋งค", "๋ง์ดํฌ๋ก", "๋ด์ผ๋ถํฐ", "๋ฆฌ๋ด์ผ"] | |
| regular_terms = ["์๋ ํ์ธ์", "๋ต", "๊ฐ์ฌํฉ๋๋ค", "์๊ณ ํ์ธ์", "์ข์ ํ๋ฃจ ๋ณด๋ด", "๋๋๊ณ ๋ญํ๋?", "์ผ์ผ", "์ค๋", "์๋ ", "๊ฒ์ํํ", "์ํฉ", "์ธํฐ๋ท", "๋ฑ ํน", "๊ณ์ข"] | |
| message = message.lower() | |
| spam_count = 0 | |
| for keyword in spam_keywords: | |
| if keyword in message: | |
| spam_count += 1 | |
| regular_count = 0 | |
| for term in regular_terms: | |
| if term in message: | |
| regular_count += 1 | |
| if re.search(r'https?://\S+', message) or re.search(r'\d{2}\.\d{2}%?', message): | |
| spam_count += 1 | |
| if spam_count > regular_count: | |
| return True | |
| else: | |
| return False | |