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.

Source Distribution

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

Uploaded Source

Built Distribution

bigram_spam_classifier-0.0.6-py3-none-any.whl (196.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page