Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vh-sentiment

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vh-sentiment

Module for accessing the Viralheat Sentiment API.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

#Viralheat Sentiment API

You must have a Viralheat account and API key to access the Sentiment API.

##Usage of the Module

Require the module

var vh_sentiment = require('viralheat-sentiment')('[Your API Key Here]');

###Make a sentiment request

vh_sentiment.get('[text (360 characters or less) that you want to analyze]', function(err, data, status) {
	if(err) {
		// Error
	} else {
		console.log(data);
	}
});

Successful response will look like:

{
    text: 'Hello! I love this product!!',
    mood: 'positive',
    prob: 0.9372610796240683,
    raw: {
        status: 200,
        error: null,
        text: '\'Hello! I love this product!!\'',
        mood: '\'positive\'',
        prob: '0.93726107962406835'
    }
}

The object contained in the raw attribute is the response returned directly from the Viralheat Sentiment API.

###Train the Sentiment Analyzer

vh_sentiment.train('[text you would like analyzed]', ['positive','negative', or 'neutral'], function(err, data, status) {
	if(err) {
		// Error
	} else {
		console.log(data);
	}
});

Standard response from a train request:

{"status":"ok"}

Keywords

FAQs

Package last updated on 14 Aug 2013

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc