Skip to content

Commit f66d84d

Browse files
committed
Merge branch 'master' into master
2 parents bec53ae + 5c11dc6 commit f66d84d

File tree

45 files changed

+416
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+416
-317
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.ibm.watson.developer_cloud.text_to_speech.v1;
2+
3+
import java.io.IOException;
4+
import java.io.InputStream;
5+
import java.nio.file.Files;
6+
import java.nio.file.Paths;
7+
import java.nio.file.StandardCopyOption;
8+
9+
import com.ibm.watson.developer_cloud.http.HttpMediaType;
10+
import com.ibm.watson.developer_cloud.language_translation.v2.LanguageTranslation;
11+
import com.ibm.watson.developer_cloud.language_translation.v2.model.TranslationResult;
12+
import com.ibm.watson.developer_cloud.text_to_speech.v1.TextToSpeech;
13+
import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voice;
14+
15+
public class TranslateAndSynthesizeExample {
16+
17+
public static void main(String[] args) throws IOException {
18+
LanguageTranslation translator = new LanguageTranslation();
19+
translator.setUsernameAndPassword("username", "password");
20+
21+
TextToSpeech synthesizer = new TextToSpeech();
22+
synthesizer.setUsernameAndPassword("username", "password");
23+
24+
String text = "Greetings from Watson Developer Cloudl";
25+
26+
// translate
27+
TranslationResult translationResult = translator.translate(text, "en", "es");
28+
String translation = translationResult.getTranslations().get(0).getTranslation();
29+
30+
// synthesize
31+
InputStream in = synthesizer.synthesize(translation, Voice.ES_LAURA, HttpMediaType.AUDIO_WAV);
32+
Files.copy(in, Paths.get("output.wav"), StandardCopyOption.REPLACE_EXISTING);
33+
34+
}
35+
}

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyLanguage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class AlchemyLanguage extends AlchemyService {
8080
public static final String XPATH = "xpath";
8181
public static final String TARGETS = "targets";
8282
public static final String ANCHOR_DATE = "anchorDate";
83-
83+
8484
// language to be used with request
8585
private LanguageSelection language = LanguageSelection.DETECT;
8686

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVision.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ public ImageKeywords getImageKeywords(File image, Boolean forceShowAll, Boolean
177177
params.put(KNOWLEDGE_GRAPH, knowledgeGraph ? 1 : 0);
178178

179179
ImageKeywords imageKeywords = executeRequest(params, AlchemyAPI.image_keywords, ImageKeywords.class);
180-
180+
181181
// Remove the NO_TAGS keywords
182182
ListIterator<ImageKeyword> iter = imageKeywords.getImageKeywords().listIterator();
183-
while (iter.hasNext()){
184-
if (iter.next().getText().equals(NO_TAGS)){
185-
iter.remove();
186-
}
183+
while (iter.hasNext()) {
184+
if (iter.next().getText().equals(NO_TAGS)) {
185+
iter.remove();
186+
}
187187
}
188188
return imageKeywords;
189189
}

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/DocumentPublicationDate.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/**
22
* Copyright 2015 IBM Corp. All Rights Reserved.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
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
76
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
7+
* http://www.apache.org/licenses/LICENSE-2.0
98
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
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.
1513
*/
1614
package com.ibm.watson.developer_cloud.alchemy.v1.model;
1715

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageFace.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,19 @@ public void setScore(Double score) {
126126
private Gender gender;
127127

128128
/** The height. */
129-
private String height;
129+
private Integer height;
130130

131131
/** The identity. */
132132
private Identity identity;
133133

134134
/** The position x. */
135-
private String positionX;
135+
private Integer positionX;
136136

137137
/** The position y. */
138-
private String positionY;
138+
private Integer positionY;
139139

140140
/** The width. */
141-
private String width;
141+
private Integer width;
142142

143143
/**
144144
* Gets the age.
@@ -163,7 +163,7 @@ public Gender getGender() {
163163
*
164164
* @return The height
165165
*/
166-
public String getHeight() {
166+
public Integer getHeight() {
167167
return height;
168168
}
169169

@@ -181,7 +181,7 @@ public Identity getIdentity() {
181181
*
182182
* @return The positionX
183183
*/
184-
public String getPositionX() {
184+
public Integer getPositionX() {
185185
return positionX;
186186
}
187187

@@ -190,7 +190,7 @@ public String getPositionX() {
190190
*
191191
* @return The positionY
192192
*/
193-
public String getPositionY() {
193+
public Integer getPositionY() {
194194
return positionY;
195195
}
196196

@@ -199,7 +199,7 @@ public String getPositionY() {
199199
*
200200
* @return The width
201201
*/
202-
public String getWidth() {
202+
public Integer getWidth() {
203203
return width;
204204
}
205205

@@ -226,7 +226,7 @@ public void setGender(Gender gender) {
226226
*
227227
* @param height The height
228228
*/
229-
public void setHeight(String height) {
229+
public void setHeight(Integer height) {
230230
this.height = height;
231231
}
232232

@@ -244,7 +244,7 @@ public void setIdentity(Identity identity) {
244244
*
245245
* @param positionX The positionX
246246
*/
247-
public void setPositionX(String positionX) {
247+
public void setPositionX(Integer positionX) {
248248
this.positionX = positionX;
249249
}
250250

@@ -253,7 +253,7 @@ public void setPositionX(String positionX) {
253253
*
254254
* @param positionY The positionY
255255
*/
256-
public void setPositionY(String positionY) {
256+
public void setPositionY(Integer positionY) {
257257
this.positionY = positionY;
258258
}
259259

@@ -262,7 +262,7 @@ public void setPositionY(String positionY) {
262262
*
263263
* @param width The width
264264
*/
265-
public void setWidth(String width) {
265+
public void setWidth(Integer width) {
266266
this.width = width;
267267
}
268268
}

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageKeyword.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public class ImageKeyword extends GenericModel {
3232
/** The text. */
3333
private String text;
3434

35+
/** The hierarchy. */
36+
private String hierarchy;
37+
3538
/**
3639
* Gets the score.
3740
*
@@ -68,4 +71,22 @@ public void setText(String text) {
6871
this.text = text;
6972
}
7073

74+
/**
75+
* Sets the hierarchy.
76+
*
77+
* @param hierarchy The hierarchy.
78+
*/
79+
public void setHierarchy(String hierarchy) {
80+
this.hierarchy = hierarchy;
81+
}
82+
83+
/**
84+
* Gets the hierarchy. A value is only present if the request that produced this instance was made
85+
* with {@code knowledgeGraph = true}.
86+
*
87+
* @return The hierarchy, if it exists.
88+
*/
89+
public String getHierarchy() {
90+
return hierarchy;
91+
}
7192
}

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneText.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ImageSceneText extends AlchemyGenericModel {
3232

3333
/** The scene text. */
3434
private String sceneText;
35-
35+
3636
/**
3737
* Gets the image faces.
3838
*
@@ -59,7 +59,7 @@ public String getUrl() {
5959
public String getSceneText() {
6060
return sceneText;
6161
}
62-
62+
6363
/**
6464
* Sets the image faces.
6565
*

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneTextLine.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ public class ImageSceneTextLine extends GenericModel {
2828
* Region.
2929
*/
3030
public static class Region extends GenericModel {
31-
31+
3232
/** The height. */
3333
private Integer height;
34-
34+
3535
/** The width. */
3636
private Integer width;
37-
37+
3838
/** The x. */
3939
private Integer x;
40-
40+
4141
/** The y. */
4242
private Integer y;
4343

@@ -118,13 +118,13 @@ public void setY(Integer y) {
118118
* A word within a line of text.
119119
*/
120120
public static class Word extends GenericModel {
121-
121+
122122
/** The confidence. */
123123
private Double confidence;
124-
124+
125125
/** The region. */
126126
private Region region;
127-
127+
128128
/** The text. */
129129
private String text;
130130

@@ -186,13 +186,13 @@ public void setText(String text) {
186186

187187
/** The confidence. */
188188
private Double confidence;
189-
189+
190190
/** The region. */
191191
private Region region;
192-
192+
193193
/** The text. */
194194
private String text;
195-
195+
196196
/** The words. */
197197
private List<Word> words;
198198

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
package com.ibm.watson.developer_cloud.alchemy.v1.model;
22

33
public enum LanguageSelection {
4-
ENGLISH,
5-
FRENCH,
6-
GERMAN,
7-
ITALIAN,
8-
PORTUGESE,
9-
RUSSIAN,
10-
SPANISH,
11-
SWEDISH,
12-
DETECT
4+
ENGLISH, FRENCH, GERMAN, ITALIAN, PORTUGESE, RUSSIAN, SPANISH, SWEDISH, DETECT
135
}

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/Sentiment.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@ public class Sentiment extends GenericModel {
3030
public enum SentimentType {
3131

3232
/** negative sentiment. */
33-
@SerializedName("negative")
34-
NEGATIVE,
33+
@SerializedName("negative") NEGATIVE,
3534

3635
/** neutral sentiment. */
37-
@SerializedName("neutral")
38-
NEUTRAL,
36+
@SerializedName("neutral") NEUTRAL,
3937

4038
/** positive sentiment. */
41-
@SerializedName("positive")
42-
POSITIVE
39+
@SerializedName("positive") POSITIVE
4340
}
4441

4542
/** The mixed. */

0 commit comments

Comments
 (0)