0.0.5 • Published 2 years ago

lang-categoriser v0.0.5

Weekly downloads
7
License
-
Repository
github
Last release
2 years ago

Text Categoriser

Introduction

A simple text categoriser which uses the NRC emotion categories to perform sentiment analysis of arbitrary text.

Installation

npm install lang-categoriser

Useage

const { category } = require('lang-categoriser')();

(async () => {
  try {
    const text = await category('I love cats but I am allergic to them.');
    console.log(JSON.stringify(text, null, 2));
  } catch (e) {}
})();

Result:

{
  "scores": {
    "joy": 0.2,
    "positive": 0.2,
    "anticipation": 0.2,
    "sadness": 0.2,
    "surprise": 0.2,
    "trust": 0.2
  },
  "tokens": {
    "positive": {
      "love": [
        "joy",
        "positive",
        "anticipation",
        "sadness",
        "surprise",
        "trust"
      ],
    },
    "negative": {}
  }
}
0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago