lang-categoriser

0.0.5 • Public • Published

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": {}
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i lang-categoriser

Weekly Downloads

1

Version

0.0.5

License

none

Unpacked Size

2.78 MB

Total Files

19

Last publish

Collaborators

  • notquiterussell