How you can use the Tone Analyzer API

Now, let's take a look at some code. Of course, since there’s no training involved, the code is relatively simple.

Let's start off by creating the service instance. Go ahead and create a new Tone Analyzer service – I'm sure you remember how, but you can still refer back to Chapter 2, Can Machines Converse Like Humans?, if necessary.

There’s no tooling since there's no training involved. You're going to be coding all the way! Let's take a look at the following steps:

  1. In Python, let's start by importing the Tone Analyzer:
from ibm_watson import ToneAnalyzerV3
  1. Next, let's initialize the service class:
service = ToneAnalyzerV3(    iam_apikey="NaPe5R7RNR-e38IRR1jT5k_ictmN1SalGmt64aTC5-f8",  version="2017-09-21") ...

Get Cognitive Computing with IBM Watson now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.