A Python library for detecting spam messages using machine learning models
Project description
pyspamdetector
pyspamdetector is a Python library that allows you to easily classify text messages as Spam or Not Spam using a pre-trained machine learning model. The library is designed to be simple and intuitive, with built-in methods to classify and describe text messages.
Table of Contents
Usage
Once you have the library installed, you can easily classify text messages. The main features are:
Basic Usage
To classify a message as spam or not, you simply need to import pyspamdetector and call the readText() method. Here's an example:
from pyspamdetector import PySpamDetector
# Instantiate the classifier
detector = PySpamDetector()
# Classify a message
is_spam = detector.readText("Congratulations, you've won a $1000 gift card! Click here to claim your prize.")
# Output classification result
print(is_spam) # Output will be True (Spam) or False (Not Spam)
Method Descriptions
-
readText(text: str) -> bool- Purpose: Classifies the provided text as Spam or Not Spam.
- Arguments:
text(str) - The message you want to classify. - Returns:
bool-Truefor Spam,Falsefor Not Spam.
-
describeText(text: str) -> dict- Purpose: Provides a general description of the message without classifying it.
- Arguments:
text(str) - The message you want to describe. - Returns:
dict- A JSON-like dictionary that includes:- The original message.
- A classification (
SpamorNot Spam). - An advice or warning about the message's nature.
Example:
description = detector.describeText("Congratulations, you've won a $1000 gift card! Click here to claim your prize.")
# Example output
{
"message": "Congratulations, you've won a $1000 gift card! Click here to claim your prize.",
"classification": "Spam",
"advice": "Be cautious! This message appears to be spam. Avoid clicking on links or providing sensitive information."
}
License
pyspamdetector is open-source and released under the GNU General Public License v3 (GPLv3). See the LICENSE file for more details.
Contributing
If you'd like to contribute to the project, feel free to fork the repository and submit a pull request. We welcome improvements and fixes!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 pyspamdetector-0.0.1.tar.gz.
File metadata
- Download URL: pyspamdetector-0.0.1.tar.gz
- Upload date:
- Size: 136.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d638c494960c27d9c9beef8a430fb5137127904d9f39691ac05f51c7f9fc60a
|
|
| MD5 |
faf6fc9c06f9f819f7c75a2625b694ca
|
|
| BLAKE2b-256 |
58c6c3c1c9c733728a67a0259703c7876b60dad573b43e4739dcf77a28e09a45
|
File details
Details for the file pyspamdetector-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyspamdetector-0.0.1-py3-none-any.whl
- Upload date:
- Size: 135.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ba20cce28f6dd182063d32660094dcac54aaca3e6f685d8fa8e889190abf094
|
|
| MD5 |
5e7cda279f3f8cd67df229a4104d937f
|
|
| BLAKE2b-256 |
9f491eb795eb140bfa89aa6dcc23cbe1ccd5752fa7c0a07b05766ad337e8e817
|