High Quality Sentiment Analysis

Notice – All publicly available Indico APIs will be deprecated on Jan 1, 2020

POST https://apiv2.indico.io/sentimenthq

Highly accurate sentiment analysis but less performant than the standard Sentiment API. Note: Sentiment HQ only supports English analysis. For multilingual support, please use the standard Sentiment API.

Current Version: 1

Private cloud endpoint

POST https://[cloud].indico.domains/sentimenthq/[batch]/

Arguments

data – String | List – required – text to be analyzed
[api_key] – String – optional – your indico API key
[cloud] – String – optional – your private cloud subdomain
[v or version] – Integer – optional (defaults to 1) – specify model version

Output

This function will return a number between 0 and 1. This number is a probability representing the likelihood that the analyzed text is positive or negative. Values greater than 0.5 indicate positive sentiment, while values less than 0.5 indicate negative sentiment.

// single output
0.9819219949985644

// batch output
[
   0.9819219949985644,
   0.00015202198176385973
]

Example

// Single Example
fetch('https://apiv2.indico.io/sentimenthq', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: 'I love writing code'
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));

// Batch Example
fetch('https://apiv2.indico.io/sentimenthq/batch', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: [
      'I love writing code',
      'Alexander and the Terrible, Horrible, No Good, Very Bad Day'
    ]
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));