You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sentiment-deftbyte

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sentiment-deftbyte

AFINN-based sentiment analysis for Node.js

5.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

sentiment-deftbyte

AFINN-based sentiment analysis for Node.js

Forked from Sentiment by thisandagain https://github.com/thisandagain/sentiment

Added Feature

1. Custom tokenization

You can add a custom function for creating tokens by adding customLabels and customTokenization in registerLanguage method

const Sentiment = require('./lib/index')
const sentiment = new Sentiment()
// require the custom tokenizetion function
const customFunction = require('./custom-tokenization') 

const idLanguage = {
  labels: {
     'berhasil': 3
     },
  customLabels: {
    "kasih sayang": 2
    "bertepuk tangan": 2
  },
  customTokenization: customFunction
};
sentiment.registerLanguage('id', idLanguage)

const analyzeOptions = {
  language: 'id'
}
const text = 'saat saya berhasil mengutarakan rasa kasih sayang ke dia, semua orang bertepuk tangan'
const result = sentiment.analyze(text, analyzeOptions)
console.dir(result)

The result will be:

{ score: 7,
  comparative: 0.6363636363636364,
  tokens:
   [ 'saat',
     'saya',
     'berhasil',
     'mengutarakan',
     'rasa',
     'kasih sayang',
     'ke',
     'dia',
     'semua',
     'orang',
     'bertepuk tangan' ],
  words: [ 'bertepuk tangan', 'kasih sayang', 'berhasil' ],
  positive: [ 'bertepuk tangan', 'kasih sayang', 'berhasil' ],
  negative: [] }

Keywords

sentiment

FAQs

Package last updated on 15 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts