Socket
Socket
Sign inDemoInstall

wink-naive-bayes-text-classifier

Package Overview
Dependencies
3
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

.nyc_output/bf700fc6-0a2e-4d1a-84ef-af1b3a7bb0d5.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"849141e9-ccfa-43f3-8915-e6670c872061":{"parent":null,"children":[]}},"files":{"/Users/neilsbohr/dev/winkjs/wink-naive-bayes-text-classifier/src/prep-text.js":["849141e9-ccfa-43f3-8915-e6670c872061"],"/Users/neilsbohr/dev/winkjs/wink-naive-bayes-text-classifier/src/wink-naive-bayes-text-classifier.js":["849141e9-ccfa-43f3-8915-e6670c872061"]},"externalIds":{}}
{"processes":{"bf700fc6-0a2e-4d1a-84ef-af1b3a7bb0d5":{"parent":null,"children":[]}},"files":{"/Users/neilsbohr/dev/winkjs/wink-naive-bayes-text-classifier/src/prep-text.js":["bf700fc6-0a2e-4d1a-84ef-af1b3a7bb0d5"],"/Users/neilsbohr/dev/winkjs/wink-naive-bayes-text-classifier/src/wink-naive-bayes-text-classifier.js":["bf700fc6-0a2e-4d1a-84ef-af1b3a7bb0d5"]},"externalIds":{}}
{
"name": "wink-naive-bayes-text-classifier",
"version": "2.1.0",
"description": "Configurable Naive Bayes Classifier for text with cross-validation support",
"version": "2.2.0",
"description": "Naive Bayes Text Classifier",
"keywords": [

@@ -9,7 +9,8 @@ "Naive Bayes",

"Machine Learning",
"Cross-validation",
"NLP",
"Natural Language Processing",
"AI",
"wink"
"Chatbot",
"Sentiment Analysis",
"winkNLP",
"Text Classification"
],

@@ -16,0 +17,0 @@ "main": "src/wink-naive-bayes-text-classifier.js",

# wink-naive-bayes-text-classifier
Configurable [Naive Bayes](https://en.wikipedia.org/wiki/Naive_Bayes_classifier) Classifier for text with cross-validation support
Naive Bayes Text Classifier

@@ -10,11 +10,18 @@ ### [![Build Status](https://app.travis-ci.com/winkjs/wink-naive-bayes-text-classifier.svg?branch=master)](https://app.travis-ci.com/winkjs/wink-naive-bayes-text-classifier) [![Coverage Status](https://coveralls.io/repos/github/winkjs/wink-naive-bayes-text-classifier/badge.svg?branch=master)](https://coveralls.io/github/winkjs/wink-naive-bayes-text-classifier?branch=master) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/winkjs/Lobby)

Classify text, analyse sentiments, recognize user intents for chatbot using **`wink-naive-bayes-text-classifier`**. Its [API](http://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html) offers a rich set of features:
Classify text, analyse sentiments, recognize user intents for chatbot using **`wink-naive-bayes-text-classifier`**. Its [API](http://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html) offers a rich set of features including cross validation to compute confusion matrix, precision, and recall. It delivers impressive accuracy levels with right text pre-processing using [wink-nlp](https://www.npmjs.com/package/wink-nlp):
1. Preprocess text using [wink-nlp](https://www.npmjs.com/package/wink-nlp) — tokenize, stem, remove stop words, and handle negation. It also supports [Named Entity Recognition](https://winkjs.org/wink-nlp/getting-started.html) to further enhance preprocessing. A single winkNLP based helper function for preparing text is available that (a) tokenizes, (b) removes punctuations, symbols, numerals, URLs, stop words and (c) stems. It can be required from `wink-naive-bayes-text-classifier/src/prep-text.js`.
2. Configure **Lidstone** or **Laplace** additive smoothing.
3. Configure **Multinomial** or **Binarized Multinomial** Naive Bayes model.
4. Export and import learnings in JSON format that can be easily saved on hard-disk.
5. Evaluate learning to perform n-fold cross validation.
6. Obtain comprehensive metrics including **confusion matrix**, **precision**, and **recall**.
| Dataset | Accuracy |
| --- | --- |
| **Sentiment Analysis**<br/>Amazon Product Review [Sentiment Labelled Sentences Data Set](https://archive.ics.uci.edu/ml/machine-learning-databases/00331/) at [UCI Machine Learning Repository](https://archive.ics.uci.edu/ml/index.php) | **90%** <br/> 800 training examples & 200 validation reviews<br/><br/>Refer to `sentiment-analysis-example` directory for the reference code |
| **Intent Classification**<br/>Chatbot corpus from [NLU Evaluation Corpora](https://github.com/sebischair/NLU-Evaluation-Corpora) as mentioned in paper titled [Evaluating Natural Language Understanding Services for Conversational Question Answering Systems](https://aclanthology.org/W17-5522.pdf) | **99%** <br/>100 training examples & 106 validation<br/><br/>Refer to `chatbot-example` directory for the reference code |
#### Text Pre-processing
A [winkNLP](https://github.com/winkjs/wink-nlp) based helper function for general purpose text pre-processing is available that (a) tokenizes, (b) removes punctuations, symbols, numerals, URLs, stop words, (c) stems each token and (d) handles negations. It can be required from `wink-naive-bayes-text-classifier/src/prep-text.js`. WinkNLP's [Named Entity Recognition](https://winkjs.org/wink-nlp/getting-started.html) may be used to further enhance the pre-processing.
#### Hyperparameters
These include smoothing factor to control [additive smoothing](https://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html#defineConfig) and a [consider presence only flag](https://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html#defineConfig) to choose from Multinomial/Binarized naive bayes.
The trained model can be [exported](https://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html#exportJSON) as JSON and can be [reloaded](https://winkjs.org/wink-naive-bayes-text-classifier/NaiveBayesTextClassifier.html#importJSON) later for predictions.
### Installation

@@ -21,0 +28,0 @@ Use [npm](https://www.npmjs.com/package/wink-naive-bayes-text-classifier) to install:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc