/haven-sentiment-analysis

🎩 A Node.js client library for HP Haven OnDemand Sentiment Analysis module

Primary LanguageJavaScript

🚨Note: The original Haven OnDemand service is not currently operational. This package will NOT work🚨

While Daven OnDemand is down, this package will no longer work. If MicroFocus (the buyer of Haven OnDemand) provides support for the original Haven OnDemand again, I will update this module accordingly, to get it working again.

In the meantime, IBM Watson, Microsoft Azure and Google Cloud offers similar text analysis products, and are free to use for small / personal projects.

Alternativley if it's just sentiment analysis your after, I have written my own stand-alone, AFINN-111 based package, here: sentiment-analysis. Hope that helps!


haven-sentiment-analysis

Node.js client for HP Haven OnDemand Sentiment Analysis

Dependency Status devDependency Status Code Climate

Install

npm install git://github.com/Lissy93/haven-sentiment-analysis.git

Usage

var sentimentAnalysis =  require('haven-sentiment-analysis');
var apiKey = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
var string = 'dinosaurs are awesome and I love ice cream';

sentimentAnalysis(string, apiKey, function(results){
    console.log(results); // Do some awesome stuff with sentiment data!
});

There is also the option of passing a JSON object rather than a String as the first paramater, in order to specify additional options. See the Haven OnDemand documentation for full list of paramater options.

Example Output

{
  "positive": [
    {
      "sentiment": "awesome",
      "topic": "dinosaurs",
      "score": 0.8952832264587852,
      "original_text": "dinosaurs are awesome",
      "original_length": 21,
      "normalized_text": "dinosaurs are awesome",
      "normalized_length": 21
    },
    {
      "sentiment": "love",
      "topic": "icecream",
      "score": 0.8053406931054015,
      "original_text": "I love icecream",
      "original_length": 15,
      "normalized_text": "I love icecream",
      "normalized_length": 15
    }
  ],
  "negative": [],
  "aggregate": {
    "sentiment": "positive",
    "score": 0.8503119597820934
  }
}

Obtaining an API Key

Head over to HP Haven OnDemand, log in or sign up and then navigate to the 'My Keys' page. API Keys are free for under 50,000 requests monthly. (at the time of writing this)

Development

See gulpfile.js for automated build tasks

License

MIT © Alicia Sykes