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 & hash File type Python version Upload date
bigram_spam_classifier-0.0.6-py3-none-any.whl (196.0 kB) View hashes Wheel py3
bigram_spam_classifier-0.0.6.tar.gz (195.0 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page