Socket
Socket
Sign inDemoInstall

sentiment-deftbyte

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sentiment-deftbyte

AFINN-based sentiment analysis for Node.js


Version published
Weekly downloads
3
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 15 Aug 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc