Spam filtering made easy for you

tasdikrahman tasdikrahman Last update: Feb 21, 2024

spammy

PyPI version Build Status Python Versions percentagecov Requirements Status License

Author

Tasdik Rahman

Latest version

1.0.3

Overview

spammy : Spam filtering at your service

spammy powers the web app https://plino.herokuapp.com

Features

  • train the classifier on your own dataset to classify your emails into spam or ham
  • Dead simple to use. See usage
  • Blazingly fast once the classifier is trained. (See benchmarks)
  • Custom exceptions raised so that when you miss something, spammy tells you where did you go wrong in a graceful way
  • Written in uncomplicated python
  • Built on top of the giant shoulders of nltk

Example

[back to top]

  • Your data directory structure should be something similar to

Example

>>> import os
>>> from spammy import Spammy
>>>
>>> directory = '/home/tasdik/Dropbox/projects/spamfilter/data/corpus3'
>>>
>>> # directory structure
>>> os.listdir(directory)
['spam', 'Summary.txt', 'ham']
>>> os.listdir(os.path.join(directory, 'spam'))[:3]
['4257.2005-04-06.BG.spam.txt', '0724.2004-09-21.BG.spam.txt', '2835.2005-01-19.BG.spam.txt']
>>>
>>> # Spammy object created
>>> cl = Spammy(directory, limit=100)
>>> cl.train()
>>>
>>> SPAM_TEXT = \
... """
... My Dear Friend,
... 
... How are you and your family? I hope you all are fine.
... 
... My dear I know that this mail will come to you as a surprise, but it's for my 
... urgent need for a foreign partner that made me to contact you for your sincere
... genuine assistance My name is Mr.Herman Hirdiramani, I am a banker by 
... profession currently holding the post of Director Auditing Department in 
... the Islamic Development Bank(IsDB)here in Ouagadougou, Burkina Faso.
... 
... I got your email information through the Burkina's Chamber of Commerce 
... and industry on foreign business relations here in Ouagadougou Burkina Faso 
... I haven'disclose this deal to any body I hope that you will not expose or 
... betray this trust and confident that I am about to repose on you for the 
... mutual benefit of our both families.
... 
... I need your urgent assistance in transferring the sum of Eight Million,
... Four Hundred and Fifty Thousand United States Dollars ($8,450,000:00) into
... your account within 14 working banking days This money has been dormant for 
... years in our bank without claim due to the owner of this fund died along with 
... his entire family and his supposed next of kin in an underground train crash 
... since years ago. For your further informations please visit 
... (http://news.bbc.co.uk/2/hi/5141542.stm)
... """
>>> cl.classify(SPAM_TEXT)
'spam'
>>>

Accuracy of the classifier

NOTE:

Installation

[back to top]

NOTE: spammy currently supports only python2

Install the dependencies first

To install use pip:

or if you don't have pipuse easy_install

Or build it yourself (only if you must):

Upgrading

To upgrade the package,

Installation behind a proxy

If you are behind a proxy, then this should work

Benchmarks

[back to top]

Spammy is blazingly fast once trained

Don't believe me? Have a look

Contributing

[back to top]

Refer CONTRIBUTING page for details

Roadmap

  • Include more algorithms for increased accuracy
  • python3 support

Licensing

[back to top]

Spammy is built by Tasdik Rahman and licensed under GPLv3.

spammy Copyright (C) 2016 Tasdik Rahman([email protected])

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

You can find a full copy of the LICENSE file here

Credits

[back to top]

If you'd like give me credit somewhere on your blog or tweet a shout out to @tasdikrahman, well hey, I'll take it.

Donation

If you have found my little bits of software of any use to you, you can help me pay my internet bills :)

Paypal badge

Instamojo

gratipay

patreon

Subscribe to our newsletter