Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News IBM Expands Watson Cognitive APIs

IBM Expands Watson Cognitive APIs

This item in japanese

IBM has recently expanded their collection of Watson Cognitive APIs to include beta updates to the Emotion and Tone Analysis APIs.

IBM Watson Emotion Analysis was added to the existing suite of AlchemyLanguage APIs. This suite of APIs joined the Watson services list as part of IBM's acquisition of AlchemyAPI roughly a year ago. The Emotion Analysis API currently processes text and attempts to rank the content against five emotions: joy, fear, sadness, disgust, and anger.

The example in the announcement blog post analyzed the text: "the day I was told that I had been accepted as a student of economics." The output emotional rankings for that text were:

  • anger: 0.045
  • disgust: 0.023
  • joy: 0.93
  • fear: 0.035
  • sadness: 0.07

From those values, developers can make inferences about the emotion conveyed in the overall text.

The API supports processing text and HTML content sent directly to the endpoint via HTTP or by passing in a URL of publicly available content on the Web. Output from the API is available in both XML and JSON formats. Pricing is per request with 1,000 API events for free per IBM Bluemix Organization. Paid pricing starts at $0.007 USD per event up to 250,000 events.

IBM Watson Tone Analyzer is similar, but adds language and social tone to the analysis.

Language tone is broken into three categories: analytical, confident, and tentative. In the case of the example text above, the analytical score was 0.39 with confidence and tentativeness being 0.

The social-tone analysis is broken into five different social tones: openness, conscientiousness, extraversion, agreeableness, and emotional range (or neuroticism) which are known as the "Big Five" personality traits. Analysis of the example text returned these metrics for those five social tones:

  • openness: 0.134
  • conscientiousness: 0.409
  • extraversion: 0.474
  • agreeableness: 0.736
  • emotional range: 0.784

This API uses a similar HTTP API using simple GET and POST requests with a single response. The documentation includes examples for curl, Node, Java, and Python. Tone Analyzer is free for the beta period via IBM Bluemix. Here's the Node example usage for the sample text from earlier:

var watson = require('watson-developer-cloud');

var tone_analyzer = watson.tone_analyzer({
  username: '{username}',
  password: '{password}',
  version: 'v3-beta',
  version_date: '2016-02-11'

tone_analyzer.tone({ text: 'the day I was told that I had been accepted as a student of economics.' },
  function(err, tone) {
    if (err)
      console.log(JSON.stringify(tone, null, 2));

IBM has made an Application Starter Kit available which uses both AlchemyLanguage and Tone Analyzer alongside the AlchemyData News API. Currently, these APIs only support English language texts.

This sample application demonstrates how to use web and social media and natural language processing to understand important topics and how people feel about those topics.

Developers interested in exploring these APIs via hands-on experience should consider the online Watson Developer Challenge (running now through April 15) as well as the in-person World of Watson Hackathon May 21-22, 2016 at Pier 36 in NYC.

Rate this Article