A node JS script that develops a Naive Bayes Model for SMS spam detection.
Naive Bayes is a probabilistic model that is based on Bayes Theorem. It is popularly used as a text categorization, whether the given text belongs to specific class or not. For example,
- Sports or Politics
- Email Spam
NodeJS and NPM
- Please download NodeJS and NPM from this link https://nodejs.org/en/download/
- Download only the stable version
--- dataset/
-test.txt
-train.txt
-readme.txt (dataset)
--- classifier.js
- Make sure you have NodeJS and NPM installed. Test it by entering the following commands in your command prompt/terminal
- Windows Users (Command Prompt)
node --version
npm --version
- Linux Users (Terminal)
nodejs -version
npm -version
- Mac Users (Terminal)
node -v
npm -v
- Download the files provided to a folder (new folder)
- Go to the directory from terminal where you have downloaded the files.
- All Operating Systems
cd <Downloaded_Directory_Location>/
- Now install the NPM Packages using the following commands :
- All Operating Systems
npm install bayes
npm install line-reader-sync
- After you have installed the necessary packages you can now execute the classifier by entering the following commands.
- Windows/Mac Operating Systems
node classifier.js
- Linux Operating Systems
nodejs classifier.js
- You can see the results on the console.