Fast Rust-based anti-spam inference engine for email classification
Project description
plp-antispam-rust
Fast Rust-based anti-spam inference engine for email classification, achieving 10x speedup over pure Python with 99.9% accuracy.
Features
- High Performance: 2,300+ emails/second inference speed (vs 220 emails/s in Python)
- Production Ready: 99.9% accuracy on real-world spam datasets
- Cross-Platform: Works on Linux, macOS (Intel/ARM), and Windows
- Python 3.9+: Compatible with Python 3.9, 3.10, 3.11, 3.12, 3.13+ (abi3 stable ABI)
- Zero Dependencies: Self-contained binary wheels, no external dependencies
Installation
pip install plp-antispam-rust
Usage
import plpas
from plpas import RustEnsemble
# Load pre-trained models
ensemble = RustEnsemble.load("path/to/models")
# Predict single email
prediction = ensemble.predict(["email text here"])
print(f"Spam probability: {prediction[0]}")
# Batch prediction (faster)
emails = ["email 1", "email 2", "email 3"]
predictions = ensemble.predict(emails)
Architecture
4-model stacked ensemble:
- Model 1: Naive Bayes + Word Unigrams
- Model 2: Logistic Regression + Word Bigrams
- Model 3: SVM + Character Trigrams
- Model 4: XGBoost + Word 1-2 Grams
- Meta-Classifier: Logistic Regression with StandardScaler
All models are pre-trained and exported to MessagePack format for fast Rust deserialization.
Performance
| Implementation | Speed (emails/s) | Accuracy |
|---|---|---|
| Python (sklearn) | 220 | 99.93% |
| Rust (this package) | 2,311 | 99.90% |
| Speedup | 10.5x | -0.03% |
License
MIT
Author
Paul Lucian Pinzariu
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plp_antispam_rust-1.0.2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: plp_antispam_rust-1.0.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 785.8 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf6729c5c4dfbd4f313be683b9393361ff0c92482bdf1473490aea233418cf23
|
|
| MD5 |
ba18dd87049e156cb6c3c71435b79112
|
|
| BLAKE2b-256 |
82a2cddae29b6020f1a2f84bf4f23f2e0eede396f0269f9d11e984c6406b1c90
|
File details
Details for the file plp_antispam_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: plp_antispam_rust-1.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 917.1 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8062e15ecc55eb744fe56b9493d1e7696c04440519119b7d58b3cae046b017e7
|
|
| MD5 |
2f092c433cac8e590f416d2c78a25b24
|
|
| BLAKE2b-256 |
6e31c0e9cd832083a8f8ff6b9eae81f64b05a17e7e5890f3054b626a3f25fb03
|
File details
Details for the file plp_antispam_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: plp_antispam_rust-1.0.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 774.2 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb6109bca748ba514f6481e51db25a6a24a41993b9171117c93c583fffa827f6
|
|
| MD5 |
051a80de0c853034d2e840dd3b5359f5
|
|
| BLAKE2b-256 |
c6cccafa77392c3514a34e729af91c601dc72a6c3a9e28d9c824a03433defe1b
|
File details
Details for the file plp_antispam_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: plp_antispam_rust-1.0.2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 850.9 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ae4d7e978e42941b17ca29c0d2c1296c4172d3153b0f0401d01fdfa223ffe9e
|
|
| MD5 |
0c9b96a658989ee1ac724342a099bb26
|
|
| BLAKE2b-256 |
6b94d1d14a99847cb774effcb664cc86693d4d184e227f2c7406c6c24cfad7a0
|