Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

spamfilter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spamfilter

Create spam filtering and mitigation pipelines with ease using fully-customizable, object oriented components.

pipPyPI
Version
3.0.0
Maintainers
1

Spamfilter logo

spamfilter

PyPI - Downloads GitHub Actions Workflow Status PyPI - License

spamfilter is a lightweight, fast and straightforward Python library that helps you to build your own spam filtering pipelines in order to keep your applications featuring user-generated content clean.

It's object-oriented and makes a quick, concise approach to remove spam easy. spamfilter is highly configurable and ships with deep integrations for third-party APIs, 🤗 Transformers AI/ML text classifiers and language models via OpenAI.

Important links

Installation

You can install spamfilter by cloning the GitHub repository, downloading it from the GitHub page or using pip - which is the recommended approach:

pip install spamfilter

Please see the installation guide for more information and methods on how to install spamfilter and its dependencies, especially if you plan to use API or machine learning functionality as this requires additional dependencies.

Usage

The most basic primer into the spamfilter library is defining a pipeline using several filters stacked on top of each other.

from spamfilter.filters import Length, SpecialChars
from spamfilter.pipelines import Pipeline

# create a new pipeline
m = Pipeline([
    # length of 10 to 200 chars, crop if needed
    Length(min_=10, max_=200, mode="crop"),
    # limit use of special characters
    SpecialChars(mode="normal")
])

# test a string against it
TEST_STRING = "This is a test string."
print(m.check(TEST_STRING).passed)

Output:

True

License

This project is published under the MIT License.

Contributing

Feel free to contribute to the project using the GitHub repository. Additions to the spam filters, pipelines and documentation are always welcome!

Learn more here if you're interested in helping out!

Keywords

anti spam

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts