Skip to content

Repository files navigation

📧 Email / SMS Spam Classifier

🚀 Project Overview

  • This project is a Machine Learning based web application that classifies Email or SMS messages as Spam or Not Spam.
  • It uses Natural Language Processing (NLP) techniques to preprocess the text and a Multinomial Naive Bayes model to detect spam messages.
  • The application is deployed using Streamlit, making it easy for anyone to use without coding.

📝 Problem Statement

  • Spam messages are unwanted and can cause security risks. This project aims to automatically classify messages as Spam or Not Spam, helping users filter unwanted messages and improve communication efficiency.

🛠 Technologies Used

  • Python – Programming language
  • Pandas – Data manipulation
  • NumPy – Numerical operations
  • NLTK – Natural Language Processing (tokenization, stopword removal, stemming)
  • Scikit-learn – Machine Learning library
  • TF-IDF Vectorizer – Feature extraction from text
  • Multinomial Naive Bayes – Machine Learning model for classification
  • Streamlit – Web app deployment

📊 Model Details

Text Preprocessing:

  • Convert text to lowercase
  • Tokenization (splitting text into words)
  • Stopword removal (removing common words like “is”, “the”)
  • Stemming (reducing words to their root form)

Feature Extraction:

  • Using TF-IDF Vectorizer to convert text into numerical features

Model Training:

  • Tested multiple models

Best Model:

  • Multinomial Naive Bayes

Evaluation Metrics:

  • Accuracy: Measures overall correctness
  • Precision: Measures how many predicted spam messages are actually spam

⚡ How to Run the Code

    1. Clone the repository or download the ZIP file
    1. Install required packages:
      • pip install pandas numpy nltk scikit-learn streamlit
    1. Run the Streamlit app:
      • streamlit run app.py
    1. Open the web app in your browser
    1. Enter any Email or SMS text and click Predict to see if it’s Spam or Not Spam

About

• Developed an NLP-based Email/SMS Spam Detection system to identify and filter unwanted messages, achieving 97% accuracy and 94% precision using Multinomial Naive Bayes. • Compared 5 ML models and evaluated performance using key classification metrics. • Deployed a real-time spam classification web app with Streamlit Cloud.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages