A Python-based spam message classification system that uses TF-IDF vectorization and the Multinomial Naive Bayes algorithm to classify SMS and email messages as Spam or Not Spam. The application also provides a user-friendly Tkinter GUI for real-time message classification.
Spam messages are one of the most common cybersecurity threats, ranging from phishing emails to fraudulent SMS campaigns. This project applies Natural Language Processing (NLP) and Machine Learning techniques to automatically classify incoming messages and assist users in identifying potentially malicious content.
The classifier preprocesses text, extracts TF-IDF features, trains a Multinomial Naive Bayes model, and predicts whether a message is spam or legitimate.
- 📧 SMS and email spam classification
- 🧹 Automatic text preprocessing and cleaning
- 📊 TF-IDF feature extraction
- 🤖 Multinomial Naive Bayes classifier
- 📈 Model performance evaluation
- 🖥️ Tkinter-based graphical user interface
- ⚡ Real-time spam prediction
Dataset
│
▼
Text Cleaning
│
▼
TF-IDF Vectorization
│
▼
Train-Test Split
│
▼
Multinomial Naive Bayes
│
▼
Prediction
│
▼
Spam / Not Spam
- Python
- Scikit-learn
- TF-IDF Vectorizer
- Multinomial Naive Bayes
- Pandas
- Regular Expressions (Regex)
- Tkinter
spam-message-classifier/
│
├── docs/
│ └── Project_Report.pdf
│
├── ham/
├── spam/
│
├── spam.csv
├── spam_classifier.py
├── requirements.txt
├── LICENSE
├── README.md
└── .gitignore
Clone the repository
git clone https://github.com/parthan2001/spam-message-classifier.gitNavigate to the project
cd spam-message-classifierInstall dependencies
pip install -r requirements.txtRun the application
python spam_classifier.py| Aspect | Detail |
|---|---|
| Stack | Python, Pandas, Scikit-learn, Tkinter |
| Domain | Machine Learning & Cybersecurity |
| Technique | TF-IDF + Multinomial Naive Bayes |
| Application | Spam Message Detection |
| Performance | Real-time message classification |
| Repository | 🔗 https://github.com/parthan2001/spam-message-classifier |
- Text preprocessing using regular expressions
- Removal of URLs, email addresses, punctuation, and numbers
- TF-IDF vectorization with unigram and bigram features
- 80:20 train-test split
- Multinomial Naive Bayes classifier
- Performance evaluation using:
- Accuracy
- Confusion Matrix
- Classification Report
- Deep Learning (LSTM/BERT) based spam detection
- Phishing URL detection
- Email attachment analysis
- Real-time email client integration
- Multilingual spam detection
- Model persistence using Pickle
- Natural Language Processing (NLP)
- Machine Learning Classification
- TF-IDF Feature Engineering
- Naive Bayes Classification
- Python GUI Development
- Cybersecurity Fundamentals
Parthan VA
M.Tech Information Security
College of Engineering Trivandrum (CET)
- GitHub: https://github.com/parthan2001
- LinkedIn: https://linkedin.com/in/parthanva
This project is licensed under the MIT License. See the LICENSE file for details.