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()
print(cls)

# 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
print(unigrams)
bigrams = classifier.inputBigrams
print(bigrams)

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

Project details


Download files

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

Files for bigram-spam-classifier, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size bigram_spam_classifier-0.0.6-py3-none-any.whl (196.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size bigram_spam_classifier-0.0.6.tar.gz (195.0 kB) File type Source Python version None Upload date Hashes View

Supported by

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