Socket
Socket
Sign inDemoInstall

ml-sentiment

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ml-sentiment

Machine learner sentiment classifier, with ability to negate words, with english and german


Version published
Weekly downloads
67
increased by21.82%
Maintainers
1
Install size
905 kB
Created
Weekly downloads
 

Readme

Source

npm version build status Dependency Status devDependency Status Code Coverage Downloads Today Downloads Month

Wat

Simple text sentiment analyser.

Install

npm install ml-sentiment

Usage

var ml = require('ml-sentiment')
ml.classify('Rainy day but still in a good mood')
//=> 2 ... (overall positive sentiment)

How

Returns a positive number for positive sentiment association and negative number for negative sentiment association.

Basics
var longSentence = `Transform json to csv data. The difference to my other
module json2csv is json2csv-stream uses streams for transforming the incoming
data. The module is built with the new streaming API from Node.js v0.10.0 but
maintains backwards compatibility to earlier Node.js versions. Listen for
header and line events or pipe the data directly to a readable stream.`

var ml = require('ml-sentiment')()
ml.classify(longSentence)
//=> 0 ... (very boring encyclopedia like text)

ml.classify('Rainy day but still in a good mood')
//=> 2 ... (overall positive sentiment)
Negations
var ml = require('ml-sentiment')()
ml.classify(`not awesome`)
//=> -3 (negative)

ml.classify(`awesome`)
//=> 3 (positive)
German
var ml = require('ml-sentiment')({lang: 'de'})
ml.classify(`Es ist nicht so toll`)
//=> (negative)

Credits

Original model and data: Finn Årup Nielsen, "A new ANEW: Evaluation of a word list for sentiment analysis in microblogs", http://arxiv.org/abs/1103.2903

For german model: R. Remus, U. Quasthoff & G. Heyer: SentiWS - a Publicly Available German-language Resource for Sentiment Analysis. In: Proceedings of the 7th International Language Ressources and Evaluation (LREC'10), 2010

Keywords

FAQs

Last updated on 03 Feb 2017

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