Skip to main content

A bigram approach for classifying Spam and Ham messages

Project description

# bigram-spam-classifier
# A bigram approach for classifying Spam and Ham messages

# install with pip
pip install bigram-spam-classifier

# import in your python file
from bigram_spam_classifier import spamclassifier

# create an object of the classifier and pass your message as the parameter
classifier = spamclassifier.classifier("Customer service annoncement. You have a New Years delivery waiting for you. Please call 07046744435 now to arrange delivery")

# classify the message

cls = classifier.classify()

# If returns 1 message is a Spam, if returns 0 message is a Ham

# find the unigrams and bigrams in the message
unigrams = classifier.inputUnigrams
bigrams = classifier.inputBigrams

# find the bigram probabilities of Spam and Ham
spam_probability = classifier.bigramPSpam
ham_probability = classifier.bigramPHam

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigram_spam_classifier-0.0.6.tar.gz (195.0 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page