https://github.com/dinever/antispam
Dead simple bayesian anti-spam classifier written in Python.
https://github.com/dinever/antispam
antispam bayes-classifier machine-learning python spam-filtering
Last synced: 2 months ago
JSON representation
Dead simple bayesian anti-spam classifier written in Python.
- Host: GitHub
- URL: https://github.com/dinever/antispam
- Owner: dinever
- Created: 2015-12-10T09:12:49.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-21T20:46:34.000Z (over 7 years ago)
- Last Synced: 2025-07-31T04:51:46.627Z (3 months ago)
- Topics: antispam, bayes-classifier, machine-learning, python, spam-filtering
- Language: Python
- Homepage: https://antispam.readthedocs.org
- Size: 2.39 MB
- Stars: 102
- Watchers: 6
- Forks: 22
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AntiSpam
[](https://pypi.python.org/pypi/antispam/)
[](https://pypi.python.org/pypi/antispam/)
[](https://opensource.org/licenses/MIT)Bayesian anti-spam classifier written in Python.
PyPI: [pypi.python.org/pypi/antispam](https://pypi.python.org/pypi/antispam)
Docs: [antispam.readthedocs.org](http://antispam.readthedocs.org)
# Installation
```
pip install antispam
```# Usage
Use the built-in model provided & trained by author:
```python
import antispamantispam.score("Cheap shoes for sale at DSW shoe store!")
# => 0.9657724517163143antispam.is_spam("Cheap shoes for sale at DSW shoe store!")
# => Trueantispam.score("Hi mark could you please send me a copy of your machine learning homework? thanks")
# => 0.0008064840568731558antispam.is_spam("Hi mark could you please send me a copy of your machine learning homework? thanks")
# => False```
Train your own modle:
```python
import antispamd = antispam.Detector("my_model.dat")
d.train("Super cheap octocats for sale at GitHub.", True)
d.train("Hi John, could you please come to my office by 3pm? Ding", False)msg1 = "Cheap shoes for sale at DSW shoe store!"
d.score(msg1)
# => 0.9999947825633266d.is_spam(msg1)
# => Truemsg2 = "Hi mark could you please send me a copy of your machine learning homework? thanks"
d.score(msg2)
# => 4.021280114849398e-08d.is_spam(msg2)
# => False
```Save your model:
```python
d.save()
```# License
[MIT Licenses](https://opensource.org/licenses/MIT)