Skip to content
A ML project for filtering spam and troll comment/emails.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A ML project for filtering spam and troll comments/emails.


Are you tired from people flooding your website/platform with spam and deceitful comments? Well, you are not the only one.

If you were wondering what big platforms like Youtube, Tripavisor, and others have done to solve (or at list limit)
this issue, Well, two words: Machine Learning. This project will help you train your machine to recognize potential spam messages by feeding it 16541 snippets of spam/ham messages.

Scikit-learn is required (check dependencies below) to train our Naive Bayes classifier.

Dataset: We are using the first 3 parts of the Enron spam dataset (minimize processing time).

If you would like to add even more accuracy to the model, you can add more parts to the data dir.


  1. Python 3.7.+
  2. numpy
  3. $ pip install numpy
  4. scikit-learn
  5. $ pip install scikit-learn


  1. Clone this project
  2. $ git clone
  3. Launch message keyword dictionary/features generations
  4. $ python 
  5. Check whether a message is a spam by passing it as an argument to The output should be "SPAM" or "NOT SPAM"
  6. $ python "Hey, this is an example comment"
You can’t perform that action at this time.