- Summary
Text mining is a wide field which has gained popularity with the huge text data being generated. Automation of several applications like sentiment analysis, document classification, topic classification, text summarization, and machine translation has been done using machine learning models.
Spam filtering is an example of document classification task which involves classifying an email as spam or non-spam (a.k.a. ham) mail.
In this project, I will go through the different steps on how to implement this kind of systems in a form of a tutorial using Python, and a publicly available mail corpus.
The output would be an API and a web application allowing the user to enter a message and get a response if it's a spam or ham.
- Data Source
Enron Email Dataset
Link: https://www.cs.cmu.edu/~enron/
- Python Libraries
For the Flask App:
For the Jupyter Notebook:
- Structure
Spamector
│ README.md
│ requirements.txt
│ app.py
│ engine.py
│ Spamector.ipynb
│ Spamector.html
│ nb_model.sav
│ nb_model.joblib
└───data
└───jupyter_images
└───static
│ └───css
│ └───img
│ └───js
└───templates
- Instructions - How to run Spamector
- Download the tarzip file.
- Extract the files.
- Start a terminal window and use cd to move to the Spamector folder.
- Run:
python app.py
- Open a web browser and type
127.0.0.1:5000
- Enjoy 😎
- Instructions - How to run the Jupyter Notebook
- From the Spamector folder in the terminal window, start a jupyter notebook session.
- From Jupyter notebook, run the Spamector notebook.
- Enjoy 😉