https://github.com/varunon9/naive-bayes-classifier
Implementing Naive Bayes Classification algorithm into PHP to classify given text as ham or spam. This application uses MySql as database.
https://github.com/varunon9/naive-bayes-classifier
classifier ham mysql-database naive-bayes-classifier php spam
Last synced: 3 months ago
JSON representation
Implementing Naive Bayes Classification algorithm into PHP to classify given text as ham or spam. This application uses MySql as database.
- Host: GitHub
- URL: https://github.com/varunon9/naive-bayes-classifier
- Owner: varunon9
- License: mit
- Created: 2016-10-24T07:42:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-16T18:32:33.000Z (over 7 years ago)
- Last Synced: 2025-03-16T17:27:11.318Z (3 months ago)
- Topics: classifier, ham, mysql-database, naive-bayes-classifier, php, spam
- Language: PHP
- Homepage:
- Size: 408 KB
- Stars: 23
- Watchers: 4
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Naive Bayes Classifier
Implementing Naive Bayes Classification algorithm into PHP to classify given text as ham or spam using MySql database.
### How to use
train('Have a pleasurable stay! Get up to 30% off + Flat 20% Cashback on Oyo Room' .
' bookings done via Paytm', $spam);
$classifier -> train('Lets Talk Fashion! Get flat 40% Cashback on Backpacks, Watches, Perfumes,' .
' Sunglasses & more', $spam);$classifier -> train('Opportunity with Product firm for Fullstack | Backend | Frontend- Bangalore', $ham);
$classifier -> train('Javascript Developer, Fullstack Developer in Bangalore- Urgent Requirement', $ham);$category = $classifier -> classify('Scan Paytm QR Code to Pay & Win 100% Cashback');
echo $category; // spam
$category = $classifier -> classify('Re: Applying for Fullstack Developer');
echo $category; // ham?>
### How to install the project-
1. Download the project and extract zip.
2. Create database in MySql-1. mysql> create database naiveBayes;
2. mysql> use naiveBayes;
3. mysql> create table trainingSet (S_NO integer primary key auto_increment, document text, category varchar(255));
4. mysql> create table wordFrequency (S_NO integer primary key auto_increment, word varchar(255), count integer, category varchar(255));3. Open a terminal and move to project folder
4. Edit database connection info in db_connect.php file
5. Execute main.php `php main.php`### Database Schema
#### Blog
https://medium.com/@varunon9/classify-emails-into-ham-and-spam-using-naive-bayes-classifier-ffddd7faa1ef##### For any bug/mistake you can create github issue. Contact [email protected] for suggestion/query.