A Spam Filter implemented in Python
A spam filter is a program that is used to detect unsolicited and unwanted email and prevent those messages from getting to a user's inbox. Indiscriminately-sent unsolicited bulk messages or, to put more simply, ‘spam’, estimated to account for over 80% of all e-mail traffic. Fortunately, these messages usually have identifying characteristics that an anti spam filter can use to block or divert them to a junk mail folder. Like other types of filtering programs, a spam filter looks for certain criteria on which it bases judgments. The criteria may be source of mail, reputation of sender, content and the user engagement.
The code focuses on the content for the filtering since it is a very widely used method and accurate too. Support vector machines (SVMs) are a set of supervised learning methods used for classification, regression and outliers detection. A Linear SupportVectorClassification (Similar to SVM(kernel='linear') ) is used in the code.
Download and install the following modules:
1)pandas - pip install pandas
2)nltk - pip install nltk and run command nltk.download()
3)sklearn - pip install sklearn
Pranav Raikote