0.0.5 • Published 3 years ago

idnaive v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Idnaive

idnaive - A Simple Node.js Naive Bayes Library

Idnaive is A Simple Node.js Naive Bayes Library.

✅ Multilanguage Stemming (Indonesia + English)\ ✅ Out String Filter\ ✅ Punctuation Filter\ ✅ Fix Zero-Frequency Problem

Installation

npm install idnaive

Usage

const NaiveBayes = require("idnaive");

const naiveBayes = new NaiveBayes("en");

const datasets = [
  ["You're doing good and expressive", "positive"],
  ["You're doing wow and nice", "positive"],
  ["What is this? very waste of time, and bad", "negative"],
];

naiveBayes.learn(...datasets);

let result = naiveBayes.classify(
  "This is bad, and you should try better because it waste my time"
);
console.log(result);

Datasets example :

DataLabel
Hello WorldInggris
Hello WorldInggris
Hello WorldArab
Kun FayakunArab

Input Data : Aku suka makan hello world

Calculation

Label | Inggris = 2/4
Label | Arab = 2/4

Hello World | Inggris = 2/2
Hello World | Arab = 1/2

P | Inggris = 2/4 x 2/2 = 0.5
P | Arab = 2/4 X 1/2 = 0.25

Parameters

  • new NaiveBayes(languageCode)
    • languageCode: languageCode determines what language used for stemming by the language code. currently idnaive supports id (Indonesia) and en (English).

License

Idnaive licensed by MIT License

Contribute

Before contributing, please read the following CODE_OF_CONDUCT.md and CONTRIBUTING.md.

Credits

Credits to their amazing open source:

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago