spamIt is a spam filter in Python using the Naive Bayes algorithm.
Use the check_modules.py
to check your system for the required dependencies.
Run get_data.py
to download a set of spam and ham actual emails in your machine, unzip the compressed files, read the text and load it into a Pandas dataframe. Convert the dataframe to a Pickle object.
Remove the punctuation, urls and numbers, and convert the words to lower case.
Split the text into individual words, stem each word and remove english stop words.
Transform the words into a tf-idf matrix with the sklearn
TfIdf transformation and create train/test sets.
Train a Naive Bayes classifier and evaluate the performance with the accuracy score.
Print the most important features.
Try out the classifier feeding it with some examples.