Skip to content

Commit 8dac882

Browse files
Merge pull request #902 from watson-developer-cloud/readme-fixes
Update READMEs
2 parents 351a1c9 + 8497462 commit 8dac882

File tree

11 files changed

+107
-84
lines changed

11 files changed

+107
-84
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ All the services:
7474
Only Assistant:
7575

7676
```gradle
77-
'com.ibm.watson.developer_cloud:assistant:5.0.1'
77+
'com.ibm.watson.developer_cloud:assistant:5.1.1'
7878
```
7979

8080
##### Development Snapshots
@@ -97,7 +97,7 @@ And then reference the snapshot version on your app module gradle
9797
Only Speech to Text:
9898

9999
```gradle
100-
'com.ibm.watson.developer_cloud:speech-to-text:5.1.1-SNAPSHOT'
100+
'com.ibm.watson.developer_cloud:speech-to-text:5.1.2-SNAPSHOT'
101101
```
102102

103103
##### JAR

assistant/README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>assistant</artifactId>
10-
<version>5.0.0</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>assistant</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -25,7 +25,9 @@ Assistant service = new Assistant("2018-02-16");
2525
service.setUsernameAndPassword("<username>", "<password>");
2626

2727
InputData input = new InputData.Builder("Hi").build();
28-
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
28+
MessageOptions options = new MessageOptions.Builder(workspaceId)
29+
.input(input)
30+
.build();
2931
MessageResponse response = service.message(options).execute();
3032
System.out.println(response);
3133
```
@@ -37,19 +39,19 @@ Context context = null;
3739

3840
// first message
3941
MessageOptions newMessageOptions = new MessageOptions.Builder()
40-
.workspaceId("<workspace-id>")
41-
.input(new InputData.Builder("First message").build())
42-
.context(context)
43-
.build();
42+
.workspaceId("<workspace-id>")
43+
.input(new InputData.Builder("First message").build())
44+
.context(context)
45+
.build();
4446

4547
MessageResponse response = service.message(newMessageOptions).execute();
4648

4749
// second message
4850
newMessageOptions = new MessageOptions.Builder()
49-
.workspaceId("<workspace-id>")
50-
.input(new InputData.Builder("Second message").build())
51-
.context(response.getContext()) // output context from the first message
52-
.build();
51+
.workspaceId("<workspace-id>")
52+
.input(new InputData.Builder("Second message").build())
53+
.context(response.getContext()) // output context from the first message
54+
.build();
5355

5456
response = service.message(newMessageOptions).execute();
5557

conversation/README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>conversation</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>conversation</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -25,7 +25,9 @@ Conversation service = new Conversation("2018-02-16");
2525
service.setUsernameAndPassword("<username>", "<password>");
2626

2727
InputData input = new InputData.Builder("Hi").build();
28-
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
28+
MessageOptions options = new MessageOptions.Builder(workspaceId)
29+
.input(input)
30+
.build();
2931
MessageResponse response = service.message(options).execute();
3032
System.out.println(response);
3133
```
@@ -37,19 +39,19 @@ Context context = null;
3739

3840
// first message
3941
MessageOptions newMessageOptions = new MessageOptions.Builder()
40-
.workspaceId("<workspace-id>")
41-
.input(new InputData.Builder("First message").build())
42-
.context(context)
43-
.build();
42+
.workspaceId("<workspace-id>")
43+
.input(new InputData.Builder("First message").build())
44+
.context(context)
45+
.build();
4446

4547
MessageResponse response = service.message(newMessageOptions).execute();
4648

4749
// second message
4850
newMessageOptions = new MessageOptions.Builder()
49-
.workspaceId("<workspace-id>")
50-
.input(new InputData.Builder("Second message").build())
51-
.context(response.getContext()) // output context from the first message
52-
.build();
51+
.workspaceId("<workspace-id>")
52+
.input(new InputData.Builder("Second message").build())
53+
.context(response.getContext()) // output context from the first message
54+
.build();
5355

5456
response = service.message(newMessageOptions).execute();
5557

language-translator/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>language-translator</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>language-translator</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -25,7 +25,10 @@ LanguageTranslator service = new LanguageTranslator();
2525
service.setUsernameAndPassword("<username>", "<password>");
2626

2727
TranslateOptions translateOptions = new TranslateOptions.Builder()
28-
.addText("hello").source(Language.ENGLISH).target(Language.SPANISH).build();
28+
.addText("hello")
29+
.source(Language.ENGLISH)
30+
.target(Language.SPANISH)
31+
.build();
2932
TranslationResult translationResult = service.translate(translateOptions).execute();
3033

3134
System.out.println(translationResult);

natural-language-classifier/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>natural-language-classifier</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>natural-language-classifier</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -23,7 +23,12 @@ Use [Natural Language Classifier](https://console.bluemix.net/docs/services/natu
2323
NaturalLanguageClassifier service = new NaturalLanguageClassifier();
2424
service.setUsernameAndPassword("<username>", "<password>");
2525

26-
Classification classification = service.classify("<classifier-id>", "Is it sunny?").execute();
26+
ClassifyOptions classifyOptions = new ClassifyOptions.Builder()
27+
.classifierId("<classifier-id>")
28+
.text("Is it sunny?")
29+
.build();
30+
31+
Classification classification = service.classify(classifyOptions).execute();
2732
System.out.println(classification);
2833
```
2934

natural-language-understanding/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>natural-language-understanding</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>natural-language-understanding</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -23,16 +23,23 @@ Language Understanding will give you results for the features you request. The s
2323
analysis by default, so the results can ignore most advertisements and other unwanted content.
2424

2525
```java
26-
NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding(
27-
"2017-02-27",
28-
"username",
29-
"password"
30-
);
31-
32-
EntitiesOptions entities = new EntitiesOptions.Builder().sentiment(true).limit(1).build();
33-
Features features = new Features.Builder().entities(entities).build();
34-
AnalyzeOptions parameters = new AnalyzeOptions.Builder().url("www.cnn.com").features(features).build();
26+
NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding("2017-02-27");
27+
service.setUsernameAndPassword("<username>", "<password>");
28+
29+
EntitiesOptions entities = new EntitiesOptions.Builder()
30+
.sentiment(true)
31+
.limit(1)
32+
.build();
33+
Features features = new Features.Builder()
34+
.entities(entities)
35+
.build();
36+
AnalyzeOptions parameters = new AnalyzeOptions.Builder()
37+
.url("www.cnn.com")
38+
.features(features)
39+
.build();
40+
3541
AnalysisResults results = service.analyze(parameters).execute();
42+
System.out.println(results);
3643
```
3744

3845
We also offer a cognitive client which makes use of this API to provide enhanced features for applications using our natural language understanding services:

personality-insights/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>personality-insights</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>personality-insights</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -42,14 +42,14 @@ String text = "Call me Ishmael. Some years ago-never mind how long precisely-hav
4242
+ "city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds "
4343
+ "it with her surf. Right and left, the streets take you waterward.";
4444

45-
ProfileOptions options = new ProfileOptions.Builder().text(text).build();
46-
Profile profile = service.profile(options).execute();
45+
ProfileOptions options = new ProfileOptions.Builder()
46+
.text(text)
47+
.build();
4748

49+
Profile profile = service.profile(options).execute();
4850
System.out.println(profile);
4951
```
5052

51-
**Note:** Don't forget to update the `text` variable! Also, if you experience
52-
authentication errors, remember that the Personality Insights service is not
53-
a free service.
53+
**Note:** Don't forget to update the `text` variable!
5454

5555
[personality_insights]: https://console.bluemix.net/docs/services/personality-insights/index.html

speech-to-text/README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>speech-to-text</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>speech-to-text</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -26,32 +26,33 @@ service.setUsernameAndPassword("<username>", "<password>");
2626
File audio = new File("src/test/resources/sample1.wav");
2727

2828
RecognizeOptions options = new RecognizeOptions.Builder()
29-
.contentType(HttpMediaType.AUDIO_WAV)
30-
.build();
29+
.audio(audio)
30+
.contentType(HttpMediaType.AUDIO_WAV)
31+
.build();
3132

32-
SpeechResults transcript = service.recognize(audio, options).execute();
33+
SpeechRecognitionResults transcript = service.recognize(options).execute();
3334
System.out.println(transcript);
3435
```
3536

3637
#### WebSocket support
3738

38-
Speech to Text supports WebSocket, the url is:
39-
`wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize`
39+
Speech to Text supports WebSocket, the url is: `wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize`
4040

41-
```java
41+
```java
4242
SpeechToText service = new SpeechToText();
4343
service.setUsernameAndPassword("<username>", "<password>");
4444

4545
InputStream audio = new FileInputStream("src/test/resources/sample1.wav");
4646

4747
RecognizeOptions options = new RecognizeOptions.Builder()
48-
.interimResults(true)
49-
.contentType(HttpMediaType.AUDIO_WAV)
50-
.build();
48+
.audio(audio)
49+
.contentType(HttpMediaType.AUDIO_WAV)
50+
.interimResults(true)
51+
.build();
5152

52-
service.recognizeUsingWebSocket(audio, options, new BaseRecognizeCallback() {
53+
service.recognizeUsingWebSocket(options, new BaseRecognizeCallback() {
5354
@Override
54-
public void onTranscription(SpeechResults speechResults) {
55+
public void onTranscription(SpeechRecognitionResults speechResults) {
5556
System.out.println(speechResults);
5657
}
5758
});
@@ -86,10 +87,11 @@ RecognizeOptions options = new RecognizeOptions.Builder()
8687
.continuous(true)
8788
.interimResults(true)
8889
//.inactivityTimeout(5) // use this to stop listening when the speaker pauses, i.e. for 5s
90+
.audio(audio)
8991
.contentType(HttpMediaType.AUDIO_RAW + "; rate=" + sampleRate)
9092
.build();
9193

92-
service.recognizeUsingWebSocket(audio, options, new BaseRecognizeCallback() {
94+
service.recognizeUsingWebSocket(options, new BaseRecognizeCallback() {
9395
@Override
9496
public void onTranscription(SpeechResults speechResults) {
9597
System.out.println(speechResults);

text-to-speech/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>text-to-speech</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>text-to-speech</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -23,7 +23,7 @@ Use the [Text to Speech][text_to_speech] service to get the available voices to
2323
TextToSpeech service = new TextToSpeech();
2424
service.setUsernameAndPassword("<username>", "<password>");
2525

26-
List<Voice> voices = service.getVoices().execute();
26+
Voices voices = service.listVoices().execute();
2727
System.out.println(voices);
2828
```
2929

tone-analyzer/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
##### Maven
66
```xml
77
<dependency>
8-
<groupId>com.ibm.watson.developer_cloud</groupId>
9-
<artifactId>tone-analyzer</artifactId>
10-
<version>5.1.1</version>
8+
<groupId>com.ibm.watson.developer_cloud</groupId>
9+
<artifactId>tone-analyzer</artifactId>
10+
<version>5.1.1</version>
1111
</dependency>
1212
```
1313

@@ -20,8 +20,7 @@
2020
Use the [Tone Analyzer][tone_analyzer] service to get the tone of your email.
2121

2222
```java
23-
final String VERSION_DATE = "2017-09-21";
24-
ToneAnalyzer service = new ToneAnalyzer(VERSION_DATE);
23+
ToneAnalyzer service = new ToneAnalyzer("2017-09-21");
2524
service.setUsernameAndPassword("<username>", "<password>");
2625

2726
String text =
@@ -37,7 +36,10 @@ String text =
3736
+ "business outcomes. Economy has nothing to do with it.";
3837

3938
// Call the service and get the tone
40-
ToneOptions toneOptions = new ToneOptions.Builder().html(text).build();
39+
ToneOptions toneOptions = new ToneOptions.Builder()
40+
.html(text)
41+
.build();
42+
4143
ToneAnalysis tone = service.tone(toneOptions).execute();
4244
System.out.println(tone);
4345
```

0 commit comments

Comments
 (0)