technifyed

Artificial Intelligence · NLP

Detect spam messages with a text classifier

Train a model on a public SMS dataset to separate spam from normal messages.

  • DifficultyIntermediate
  • Estimated time1–2 weeks
  • Budget₹0
  • ClassClass 11 to college
  • TeamSolo or up to 2
  • You needComputer only

Prerequisites: Python basics; some pandas helps

Original · by TechnifyedAI/ML ProjectPortfolio ProjectFree to doComputer onlyPortfolio focusedWell documented

My projects

Overview

A public dataset of about 5,500 labelled SMS messages is enough to train a classifier that catches most spam. You turn each message into word counts and train a naive Bayes model.

Why build this?

It is a real product feature, and it teaches why accuracy alone is misleading when one class is rare.

What you will learn

  • How to turn text into numbers
  • How naive Bayes classifies
  • Why precision and recall matter more than accuracy here
  • How to read which words drive a decision

Skills you will use

Feature extractionPrecision and recallText cleaning

Materials and tools

  • Computer with Python 3
  • scikit-learn
  • A public SMS spam dataset

Tools and software

pandasPythonscikit-learn

Expected cost₹0Nothing to buy
Estimated duration1–2 weeks6 build steps, plus the report

Step-by-step roadmap

  1. Start

    You will finish with: a classifier with its metrics, the top spam words and examples of mistakes.

  2. 1

    Prerequisites

    Know this first: python basics; some pandas helps. Then collect the 3 items in the materials list.

  3. 2

    Learn

    • How to turn text into numbers
    • How naive Bayes classifies
    • Why precision and recall matter more than accuracy here
    • How to read which words drive a decision
  4. 3

    Plan

    List the features for version one, sketch the screens or data flow and pick the tools. Keep the first version small.

  5. 4

    Build

    1. Load the dataset and count spam and normal messages.
    2. Clean the text: lower case and remove punctuation.
    3. Convert messages to word-count vectors.
    4. Train naive Bayes on 80 percent and test on 20 percent.
    5. Report precision, recall and the confusion matrix.
    6. List the ten words that most indicate spam.
  6. 5

    Test

    Type five messages of your own, including a tricky one, and check the predictions.

  7. 6

    Document

    Write a README: what it does, how to run it, screenshots and what you learned. Report structure

  8. 7

    Present

    Show a live demo of one complete task, then the design and the hardest problem you solved. Presentation structure · Viva questions

  9. 8

    Publish

    Put the code on GitHub with the README and, if you can, deploy a live demo.

Expected outcome

A classifier with its metrics, the top spam words and examples of mistakes.

Other versions of this project

Beginner version

Count spam words by hand in 50 messages and write a rule-based filter.

Advanced version

Compare naive Bayes with logistic regression and TF-IDF features.

Research version

Test how well the model works on messages from a different year or country and discuss why it degrades.

Portfolio version

Wrap it in a small web page where anyone can paste a message.

Make this project better

  1. BasicCount spam words by hand in 50 messages and write a rule-based filter.
  2. This projectDetect spam messages with a text classifier
  3. AdvancedCompare naive Bayes with logistic regression and TF-IDF features.
  4. ResearchTest how well the model works on messages from a different year or country and discuss why it degrades.
  5. PortfolioWrap it in a small web page where anyone can paste a message.

Ways to do this project

Text marked "You write this" is a prompt for your own work; everything else is specific to this project.

Research question
You write thisOne question you can answer with data, narrow enough to finish in the time you have.
Hypothesis
You write thisWhat you expect to find, and why.
Variables
You write thisWhat you change or compare, what you measure, and what you hold constant.
Methodology
Test how well the model works on messages from a different year or country and discuss why it degrades.
Data collection
You write thisSay what you will record, how many times, and how you will keep the records safe.
Analysis
You write thisChoose the table, chart or test that answers the question; report averages with their spread.
Limitations
You write thisList what could have affected the result: small sample, instrument limits, things you could not control.

Literature review

Find five to eight sources (your textbook, review articles, reports) and note what each says about your question. Group them by idea, not one after another, and end with what is still not known.

References

List every source you used in one style throughout (author, year, title, where it was published, link and the date you opened it).

Working as a team

Solo or up to 2. Suggested roles:

FrontendBackendData or modelDesignTestingDocumentationPresentation

Report and presentation

Report structure

  1. Title and summary
  2. Problem and target user
  3. Features
  4. Tools and technology
  5. Design: architecture, data model or screens
  6. Implementation
  7. Testing
  8. Results and screenshots
  9. Challenges
  10. Future improvements
  11. References

Presentation structure

  1. The problem
  2. Who it is for
  3. Live demo
  4. How it is built (one diagram)
  5. The hardest part
  6. Testing and results
  7. What you learned
  8. What comes next

Viva questions

Try answering before you open each one.

Why is accuracy misleading here?

About 87 percent of messages are not spam, so always guessing "not spam" already scores 87 percent.

What is precision?

Of the messages flagged as spam, the share that really are spam.

What is recall?

Of all real spam, the share the model caught.

Which mistake is worse?

Marking a real message as spam, because the user may never see it.

Resources

Source and attribution

Original

Written by Technifyed. Free to use for your own school or college project; write the report in your own words. Added 1 Oct 2026.

Similar projects

More Artificial Intelligence projects

Artificial Intelligence + EdTech and Study Tools

Build a plagiarism checker for assignments

Compare a set of documents pairwise and highlight overlapping passages.

  • Intermediate
  • 1–2 weeks
  • Free
Software Project · Computer onlyView

Artificial Intelligence · NLP

Analyse sentiment in product reviews

Train a model to label reviews positive or negative and study what it gets wrong.

  • Intermediate
  • 1–2 weeks
  • Free
AI/ML Project · Computer onlyView

Artificial Intelligence · NLP

Build a rule-based chatbot for school FAQs

Answer common questions about your school with keyword matching and a fallback reply.

  • Easy
  • 2–7 days
  • Free
Software Project · Computer onlyView

Same tools

Literature and English + Data

Analyse word use in a novel with a computer

Count words and character mentions in a public-domain novel and see what the numbers reveal.

  • Intermediate
  • 1–2 weeks
  • Free
Data Analysis · Computer onlyView

Games, Graphics and New Tech · Blockchain

Build a simple blockchain

Implement blocks, hashes, proof of work and validation to see how a chain resists tampering.

  • Intermediate
  • 1–2 weeks
  • Free
Software Project · Computer onlyView

Two-subject alternatives

Agricultural Technology + Artificial Intelligence

Monitor crop health with phone photographs

Photograph leaves weekly under the same conditions and track greenness as a sign of health.

  • Intermediate
  • 2–4 weeks
  • Free
Data Analysis · A phoneView

Languages and Linguistics + Artificial Intelligence

Compare human and computer translation

Translate ten sentences yourself and with a free online tool and classify the differences.

  • Intermediate
  • 2–7 days
  • Free
Research Project · Computer onlyView

Same difficulty and budget

Software Development · Mobile Apps

Build a habit tracker with streaks

Create an Android app to tick off daily habits and see streaks and a calendar heat map.

  • Intermediate
  • 1–2 weeks
  • Free
Mobile App · Computer onlyView

Data + Operations, HR and Supply Chain

Build a sales dashboard

Turn a public retail dataset into a one-page dashboard that answers a manager's questions.

  • Intermediate
  • 1–2 weeks
  • Free
Visualization · Computer onlyView

Artificial Intelligence + Marketing

Cluster customers into groups

Group customers by spending behaviour with k-means and describe each group in plain words.

  • Intermediate
  • 1–2 weeks
  • Free
AI/ML Project · Computer onlyView

Enter your email and the official page opens. Phone is optional.