AntiSpam
Bayesian anti-spam classifier written in Python.
Installation
pip install antispam
Usage
Use the built-in training model provided by antispam:
import antispam
antispam.score("Cheap shoes for sale at DSW shoe store!")
# => 0.9657724517163143
antispam.isspam("Cheap shoes for sale at DSW shoe store!")
# => True
antispam.score("Hi mark could you please send me a copy of your machine learning homework? thanks")
# => 0.0008064840568731558
antispam.score("Hi mark could you please send me a copy of your machine learning homework? thanks")
# => False
Train your own modle.
import antispam
d = 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.9999947825633266
d.is_spam(msg1)
# => True
msg2 = "Hi mark could you please send me a copy of your machine learning homework? thanks"
d.score(msg2)
# => 4.021280114849398e-08
d.is_spam(msg2)
# => False
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
antispam-0.0.7.tar.gz
(1.5 MB
view details)
File details
Details for the file antispam-0.0.7.tar.gz.
File metadata
- Download URL: antispam-0.0.7.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38950900aa3c521100743f806acc4eaae04896e492e864e3c0ad92bca06b7b90
|
|
| MD5 |
e41264a5010bfd4fd359b8c52da4341f
|
|
| BLAKE2b-256 |
6976f10550d60aa4d02974d76d6582b9f62157b0ceeb27da00c842994038a88f
|