11# Watson Developer Cloud Java Wrapper
22[ ![ Build Status] ( https://secure.travis-ci.org/watson-developer-cloud/java-wrapper.png )] ( http://travis-ci.org/watson-developer-cloud/java-wrapper )
3+
34Java code wrappers to quickly get started with the various [ Watson Developer Cloud] [ wdc ] services - A collection of REST APIs and SDKs that use cognitive computing to solve complex problems.
45
56## Table of Contents
@@ -12,6 +13,7 @@ Java code wrappers to quickly get started with the various [Watson Developer Clo
1213 * [ Getting the Service Credentials] ( #getting-the-service-credentials )
1314 * [ IBM Watson Services] ( #ibm-watson-services )
1415 * [ Concept Expansion] ( #concept-expansion )
16+ * [ Dialog] ( #dialog )
1517 * [ Language Identification] ( #language-identification )
1618 * [ Language Translation] ( #language-translation )
1719 * [ Machine Translation] ( #machine-translation )
@@ -22,6 +24,7 @@ Java code wrappers to quickly get started with the various [Watson Developer Clo
2224 * [ Relationship Extraction] ( #relationship-extraction )
2325 * [ Speech to Text] ( #speech-to-text )
2426 * [ Text to Speech] ( #text-to-speech )
27+ * [ Tone Analyzer] ( #tone-analyzer )
2528 * [ Tradeoff Analytics] ( #tradeoff-analytics )
2629 * [ Visual Recognition] ( #visual-recognition )
2730 * [ Running in Bluemix] ( #running-in-bluemix )
@@ -48,13 +51,13 @@ Now, you are ready to see some [examples](https://github.com/watson-developer-cl
4851<dependency >
4952 <groupId >com.ibm.watson.developer_cloud</groupId >
5053 <artifactId >java-wrapper</artifactId >
51- <version >0.1.9 </version >
54+ <version >1. 0.1</version >
5255</dependency >
5356```
5457##### Gradle
5558
5659``` gradle
57- 'com.ibm.watson.developer_cloud:java-wrapper:0.1.9 '
60+ 'com.ibm.watson.developer_cloud:java-wrapper:1. 0.1'
5861```
5962
6063## Usage
@@ -108,6 +111,19 @@ while (service.getJobStatus(job) == Job.Status.AWAITING_WORK
108111System . out. println(service. getJobResult(job));
109112```
110113
114+ ### Dialog
115+ Returns the dialog list using the [ Dialog] [ dialog ] service.
116+
117+ ``` java
118+ import com.ibm.watson.developer_cloud.dialog.v1.DialogService ;
119+ import com.ibm.watson.developer_cloud.dialog.v1.model.Dialog ;
120+
121+ DialogService service = new DialogService ();
122+ service. setUsernameAndPassword(" <username>" , " <password>" );
123+
124+ List<Dialog > dialogs = service. getDialogs();
125+ System . out. println(dialogs);
126+ ```
111127
112128### Language Identification
113129Example: Identify a language using the [ Language Identification] [ language_identification ] service.
@@ -274,15 +290,15 @@ import java.io.File;
274290SpeechToText service = new SpeechToText ();
275291service. setUsernameAndPassword(" <username>" , " <password>" );
276292
277- File audio = new File (" sample1.wav" );
293+ File audio = new File (" src/test/resources/ sample1.wav" );
278294
279295SpeechResults transcript = service. recognize(audio, " audio/l16; rate=44100" );
280296System . out. println(transcript);
281297```
282298
283299#### WebSocket support
284300
285- Speech to Text supports WebSocket so you can use a websocket client like the one in: http://java-websocket.org/
301+ Speech to Text supports WebSocket so you can use a WebSocket client like the one in: http://java-websocket.org/
286302The websocket url is: ` wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize `
287303
288304### Text to Speech
@@ -299,6 +315,30 @@ List<Voice> voices = service.getVoices();
299315System . out. println(voices);
300316```
301317
318+ ### Tone Analyzer
319+ Use the [ Tone Analyzer] [ tone_analyzer ] service to get the tone of your email.
320+
321+ ``` java
322+ import com.ibm.watson.developer_cloud.tone_analyzer.v1.ToneAnalyzer ;
323+ import com.ibm.watson.developer_cloud.tone_analyzer.v1.model.Scorecard ;
324+ import com.ibm.watson.developer_cloud.tone_analyzer.v1.model.SynonymResult ;
325+ import com.ibm.watson.developer_cloud.tone_analyzer.v1.model.Tone ;
326+
327+ ToneAnalyzer service = new ToneAnalyzer ();
328+ service. setUsernameAndPassword(" <username>" , " <password>" );
329+
330+ String text = " I know the times are difficult! Our sales have been "
331+ + " disappointing for the past three quarters for our data analytics "
332+ + " product suite. We have a competitive data analytics product "
333+ + " suite in the industry. But we need to do our job selling it! "
334+ + " We need to acknowledge and fix our sales challenges." ;
335+
336+ // Call the service and get the tone
337+ Tone tone = service. getTone(text, Scorecard . EMAIL );
338+ System . out. println(tone);
339+ ```
340+
341+
302342### Tradeoff Analytics
303343Use the [ Tradeoff Analytics] [ tradeoff_analytics ] service to find the best
304344phone that minimizes price and weight and maximizes screen size.
@@ -362,10 +402,10 @@ import java.io.File;
362402VisualRecognition service = new VisualRecognition ();
363403service. setUsernameAndPassword(" <username>" , " <password>" );
364404
365- File image = new File (" car.png" );
405+ File image = new File (" src/test/resources/ car.png" );
366406
367407LabelSet labelSet = new LabelSet ();
368- labelSet. withLabelGroup(" Animal " ). withLabelGroup(" Food " );
408+ labelSet. withLabelGroup(" Auto Racing " ). withLabelGroup(" Sports " );
369409
370410RecognizedImage recognizedImage = service. recognize(image, labelSet);
371411System . out. println(recognizedImage);
@@ -387,7 +427,7 @@ Gradle:
387427
388428 ``` sh
389429 $ cd java-wrapper
390- $ gradle jar # build jar file (build/libs/watson-developer-cloud-0.1.8 .jar)
430+ $ gradle jar # build jar file (build/libs/watson-developer-cloud-1. 0.1.jar)
391431 $ gradle test # run tests
392432 ```
393433
@@ -440,6 +480,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
440480[ tradeoff_analytics ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tradeoff-analytics/
441481[ text_to_speech ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/text-to-speech/
442482[ speech_to_text ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/speech-to-text/
483+ [ tone-analyzer ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/tone-analyzer/
484+ [ dialog ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/dialog/
485+
443486[ wdc ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/
444487[ vcap_environment ] : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/getting_started/index.html#EnvVars
445488[ bluemix ] : https://console.ng.bluemix.net
0 commit comments