Skip to main content
# AntiSpam

[![downloads](https://img.shields.io/pypi/dm/antispam.svg)](https://pypi.python.org/pypi/antispam/)
[![version](https://img.shields.io/pypi/v/antispam.svg?label=version)](https://pypi.python.org/pypi/antispam/)
[![supported](https://img.shields.io/pypi/pyversions/antispam.svg)](https://pypi.python.org/pypi/antispam/)
[![license](https://img.shields.io/pypi/l/antispam.svg)](https://opensource.org/licenses/MIT)

Bayesian anti-spam classifier written in Python.

PyPI: [pypi.python.org/pypi/antispam](https://pypi.python.org/pypi/antispam)

# Installation

```
pip install antispam
```

# Usage

Use the built-in model provided & trained by author:

```python
import antispam

antispam.score("Cheap shoes for sale at DSW shoe store!")
# => 0.9657724517163143

antispam.is_spam("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.is_spam("Hi mark could you please send me a copy of your machine learning homework? thanks")
# => False

```

Train your own modle:

```python
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
```

Save your model:

```python
d.save()
```

##License

[MIT Licenses](https://opensource.org/licenses/MIT)

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.8.tar.gz (1.5 MB view details)

Uploaded Source

File details

Details for the file antispam-0.0.8.tar.gz.

File metadata

  • Download URL: antispam-0.0.8.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for antispam-0.0.8.tar.gz
Algorithm Hash digest
SHA256 bbeeff75cec2763bf59d80a38b75dcbc290c684d0351a0c70e8732cde420e16a
MD5 d1e2b0b9484a9e1126affa54c7ac31a1
BLAKE2b-256 b59923deb3002304e90f914fe0edcc9fea967012a2809bb2f09ad15a247216be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page