Skip to content

Commit 98a6274

Browse files
[tone-analyzer] v3 updated
1 parent 7dd7dd7 commit 98a6274

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ APIs and SDKs that use cognitive computing to solve complex problems.
1414
* [Usage](#usage)
1515
* [Getting the Service Credentials](#getting-the-service-credentials)
1616
* [Questions](#questions)
17-
* [Examples](#examples)
1817
* [IBM Watson Services](#ibm-watson-services)
1918
* [Alchemy Language](#alchemy-language)
2019
* [Alchemy Vision](#alchemy-vision)
@@ -23,9 +22,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2322
* [Concept Insights](#concept-insights)
2423
* [Dialog](#dialog)
2524
* [Document Conversion](#document-conversion)
26-
* [Language Identification](#language-identification)
2725
* [Language Translation](#language-translation)
28-
* [Machine Translation](#machine-translation)
2926
* [Natural Language Classifier](#natural-language-classifier)
3027
* [Personality Insights](#personality-insights)
3128
* [Relationship Extraction](#relationship-extraction)
@@ -38,9 +35,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
3835
* [Visual Recognition](#visual-recognition)
3936
* [Android](#android)
4037
* [Running in Bluemix](#running-in-bluemix)
41-
* [Build + Test](#build--test)
4238
* [Eclipse and Intellij](#working-with-eclipse-and-intellij-idea)
43-
* [Open Source @ IBM](#open-source--ibm)
4439
* [License](#license)
4540
* [Contributing](#contributing)
4641

@@ -365,9 +360,10 @@ System.out.println(voices);
365360
Use the [Tone Analyzer][tone_analyzer] service to get the tone of your email.
366361

367362
```java
368-
ToneAnalyzer service = new ToneAnalyzer();
363+
ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_02_11);
369364
service.setUsernameAndPassword("<username>", "<password>");
370365

366+
371367
String text = "I know the times are difficult! Our sales have been "
372368
+ "disappointing for the past three quarters for our data analytics "
373369
+ "product suite. We have a competitive data analytics product "
@@ -377,6 +373,10 @@ String text = "I know the times are difficult! Our sales have been "
377373
// Call the service and get the tone
378374
Tone tone = service.getTone(text, Scorecard.EMAIL);
379375
System.out.println(tone);
376+
377+
378+
ToneAnalysis tone = service.getTone(text);
379+
System.out.println(tone);
380380
```
381381

382382

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
package com.ibm.watson.developer_cloud.tone_analyzer.v3;
15+
16+
import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis;
17+
18+
public class ToneAnalyzerExample {
19+
20+
21+
public static void main(String[] args) {
22+
ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_02_11);
23+
service.setUsernameAndPassword("<username>", "<password>");
24+
25+
String text =
26+
"I know the times are difficult! Our sales have been "
27+
+ "disappointing for the past three quarters for our data analytics "
28+
+ "product suite. We have a competitive data analytics product "
29+
+ "suite in the industry. But we need to do our job selling it! "
30+
+ "We need to acknowledge and fix our sales challenges. "
31+
+ "We can’t blame the economy for our lack of execution! "
32+
+ "We are missing critical sales opportunities. "
33+
+ "Our product is in no way inferior to the competitor products. "
34+
+ "Our clients are hungry for analytical tools to improve their "
35+
+ "business outcomes. Economy has nothing to do with it.";
36+
37+
// Call the service and get the tone
38+
ToneAnalysis tone = service.getTone(text);
39+
System.out.println(tone);
40+
41+
}
42+
}

0 commit comments

Comments
 (0)