diff --git a/README.md b/README.md index 8b15d371b33..8eca47aee19 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ All the services: Only Assistant: ```gradle -'com.ibm.watson.developer_cloud:assistant:5.0.1' +'com.ibm.watson.developer_cloud:assistant:5.1.1' ``` ##### Development Snapshots @@ -97,7 +97,7 @@ And then reference the snapshot version on your app module gradle Only Speech to Text: ```gradle -'com.ibm.watson.developer_cloud:speech-to-text:5.1.1-SNAPSHOT' +'com.ibm.watson.developer_cloud:speech-to-text:5.1.2-SNAPSHOT' ``` ##### JAR diff --git a/assistant/README.md b/assistant/README.md index cdbdd3ae467..fcc4c5e6d0b 100644 --- a/assistant/README.md +++ b/assistant/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - assistant - 5.0.0 + com.ibm.watson.developer_cloud + assistant + 5.1.1 ``` @@ -25,7 +25,9 @@ Assistant service = new Assistant("2018-02-16"); service.setUsernameAndPassword("", ""); InputData input = new InputData.Builder("Hi").build(); -MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build(); +MessageOptions options = new MessageOptions.Builder(workspaceId) + .input(input) + .build(); MessageResponse response = service.message(options).execute(); System.out.println(response); ``` @@ -37,19 +39,19 @@ Context context = null; // first message MessageOptions newMessageOptions = new MessageOptions.Builder() - .workspaceId("") - .input(new InputData.Builder("First message").build()) - .context(context) - .build(); + .workspaceId("") + .input(new InputData.Builder("First message").build()) + .context(context) + .build(); MessageResponse response = service.message(newMessageOptions).execute(); // second message newMessageOptions = new MessageOptions.Builder() - .workspaceId("") - .input(new InputData.Builder("Second message").build()) - .context(response.getContext()) // output context from the first message - .build(); + .workspaceId("") + .input(new InputData.Builder("Second message").build()) + .context(response.getContext()) // output context from the first message + .build(); response = service.message(newMessageOptions).execute(); diff --git a/conversation/README.md b/conversation/README.md index 7125bd79273..778492cdfe3 100644 --- a/conversation/README.md +++ b/conversation/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - conversation - 5.1.1 + com.ibm.watson.developer_cloud + conversation + 5.1.1 ``` @@ -25,7 +25,9 @@ Conversation service = new Conversation("2018-02-16"); service.setUsernameAndPassword("", ""); InputData input = new InputData.Builder("Hi").build(); -MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build(); +MessageOptions options = new MessageOptions.Builder(workspaceId) + .input(input) + .build(); MessageResponse response = service.message(options).execute(); System.out.println(response); ``` @@ -37,19 +39,19 @@ Context context = null; // first message MessageOptions newMessageOptions = new MessageOptions.Builder() - .workspaceId("") - .input(new InputData.Builder("First message").build()) - .context(context) - .build(); + .workspaceId("") + .input(new InputData.Builder("First message").build()) + .context(context) + .build(); MessageResponse response = service.message(newMessageOptions).execute(); // second message newMessageOptions = new MessageOptions.Builder() - .workspaceId("") - .input(new InputData.Builder("Second message").build()) - .context(response.getContext()) // output context from the first message - .build(); + .workspaceId("") + .input(new InputData.Builder("Second message").build()) + .context(response.getContext()) // output context from the first message + .build(); response = service.message(newMessageOptions).execute(); diff --git a/language-translator/README.md b/language-translator/README.md index 6c1c5f5649e..41f3558bea5 100644 --- a/language-translator/README.md +++ b/language-translator/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - language-translator - 5.1.1 + com.ibm.watson.developer_cloud + language-translator + 5.1.1 ``` @@ -25,7 +25,10 @@ LanguageTranslator service = new LanguageTranslator(); service.setUsernameAndPassword("", ""); TranslateOptions translateOptions = new TranslateOptions.Builder() - .addText("hello").source(Language.ENGLISH).target(Language.SPANISH).build(); + .addText("hello") + .source(Language.ENGLISH) + .target(Language.SPANISH) + .build(); TranslationResult translationResult = service.translate(translateOptions).execute(); System.out.println(translationResult); diff --git a/natural-language-classifier/README.md b/natural-language-classifier/README.md index 2de30482085..34040d29f6a 100644 --- a/natural-language-classifier/README.md +++ b/natural-language-classifier/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - natural-language-classifier - 5.1.1 + com.ibm.watson.developer_cloud + natural-language-classifier + 5.1.1 ``` @@ -23,7 +23,12 @@ Use [Natural Language Classifier](https://console.bluemix.net/docs/services/natu NaturalLanguageClassifier service = new NaturalLanguageClassifier(); service.setUsernameAndPassword("", ""); -Classification classification = service.classify("", "Is it sunny?").execute(); +ClassifyOptions classifyOptions = new ClassifyOptions.Builder() + .classifierId("") + .text("Is it sunny?") + .build(); + +Classification classification = service.classify(classifyOptions).execute(); System.out.println(classification); ``` diff --git a/natural-language-understanding/README.md b/natural-language-understanding/README.md index 2637fe222f6..23affc43631 100644 --- a/natural-language-understanding/README.md +++ b/natural-language-understanding/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - natural-language-understanding - 5.1.1 + com.ibm.watson.developer_cloud + natural-language-understanding + 5.1.1 ``` @@ -23,16 +23,23 @@ Language Understanding will give you results for the features you request. The s analysis by default, so the results can ignore most advertisements and other unwanted content. ```java -NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding( - "2017-02-27", - "username", - "password" -); - -EntitiesOptions entities = new EntitiesOptions.Builder().sentiment(true).limit(1).build(); -Features features = new Features.Builder().entities(entities).build(); -AnalyzeOptions parameters = new AnalyzeOptions.Builder().url("www.cnn.com").features(features).build(); +NaturalLanguageUnderstanding service = new NaturalLanguageUnderstanding("2017-02-27"); +service.setUsernameAndPassword("", ""); + +EntitiesOptions entities = new EntitiesOptions.Builder() + .sentiment(true) + .limit(1) + .build(); +Features features = new Features.Builder() + .entities(entities) + .build(); +AnalyzeOptions parameters = new AnalyzeOptions.Builder() + .url("www.cnn.com") + .features(features) + .build(); + AnalysisResults results = service.analyze(parameters).execute(); +System.out.println(results); ``` We also offer a cognitive client which makes use of this API to provide enhanced features for applications using our natural language understanding services: diff --git a/personality-insights/README.md b/personality-insights/README.md index 843387b4ccd..f1eb9e75f7a 100755 --- a/personality-insights/README.md +++ b/personality-insights/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - personality-insights - 5.1.1 + com.ibm.watson.developer_cloud + personality-insights + 5.1.1 ``` @@ -42,14 +42,14 @@ String text = "Call me Ishmael. Some years ago-never mind how long precisely-hav + "city of the Manhattoes, belted round by wharves as Indian isles by coral reefs-commerce surrounds " + "it with her surf. Right and left, the streets take you waterward."; -ProfileOptions options = new ProfileOptions.Builder().text(text).build(); -Profile profile = service.profile(options).execute(); +ProfileOptions options = new ProfileOptions.Builder() + .text(text) + .build(); +Profile profile = service.profile(options).execute(); System.out.println(profile); ``` -**Note:** Don't forget to update the `text` variable! Also, if you experience -authentication errors, remember that the Personality Insights service is not -a free service. +**Note:** Don't forget to update the `text` variable! [personality_insights]: https://console.bluemix.net/docs/services/personality-insights/index.html diff --git a/speech-to-text/README.md b/speech-to-text/README.md index 2751cc26073..79c73c653e2 100755 --- a/speech-to-text/README.md +++ b/speech-to-text/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - speech-to-text - 5.1.1 + com.ibm.watson.developer_cloud + speech-to-text + 5.1.1 ``` @@ -26,32 +26,33 @@ service.setUsernameAndPassword("", ""); File audio = new File("src/test/resources/sample1.wav"); RecognizeOptions options = new RecognizeOptions.Builder() - .contentType(HttpMediaType.AUDIO_WAV) - .build(); + .audio(audio) + .contentType(HttpMediaType.AUDIO_WAV) + .build(); -SpeechResults transcript = service.recognize(audio, options).execute(); +SpeechRecognitionResults transcript = service.recognize(options).execute(); System.out.println(transcript); ``` #### WebSocket support -Speech to Text supports WebSocket, the url is: - `wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize` +Speech to Text supports WebSocket, the url is: `wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize` - ```java +```java SpeechToText service = new SpeechToText(); service.setUsernameAndPassword("", ""); InputStream audio = new FileInputStream("src/test/resources/sample1.wav"); RecognizeOptions options = new RecognizeOptions.Builder() - .interimResults(true) - .contentType(HttpMediaType.AUDIO_WAV) - .build(); + .audio(audio) + .contentType(HttpMediaType.AUDIO_WAV) + .interimResults(true) + .build(); -service.recognizeUsingWebSocket(audio, options, new BaseRecognizeCallback() { +service.recognizeUsingWebSocket(options, new BaseRecognizeCallback() { @Override - public void onTranscription(SpeechResults speechResults) { + public void onTranscription(SpeechRecognitionResults speechResults) { System.out.println(speechResults); } }); @@ -86,10 +87,11 @@ RecognizeOptions options = new RecognizeOptions.Builder() .continuous(true) .interimResults(true) //.inactivityTimeout(5) // use this to stop listening when the speaker pauses, i.e. for 5s + .audio(audio) .contentType(HttpMediaType.AUDIO_RAW + "; rate=" + sampleRate) .build(); -service.recognizeUsingWebSocket(audio, options, new BaseRecognizeCallback() { +service.recognizeUsingWebSocket(options, new BaseRecognizeCallback() { @Override public void onTranscription(SpeechResults speechResults) { System.out.println(speechResults); diff --git a/text-to-speech/README.md b/text-to-speech/README.md index 79020536d10..7fa898ac1c7 100755 --- a/text-to-speech/README.md +++ b/text-to-speech/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - text-to-speech - 5.1.1 + com.ibm.watson.developer_cloud + text-to-speech + 5.1.1 ``` @@ -23,7 +23,7 @@ Use the [Text to Speech][text_to_speech] service to get the available voices to TextToSpeech service = new TextToSpeech(); service.setUsernameAndPassword("", ""); -List voices = service.getVoices().execute(); +Voices voices = service.listVoices().execute(); System.out.println(voices); ``` diff --git a/tone-analyzer/README.md b/tone-analyzer/README.md index de7996cc0e8..861e98af36f 100755 --- a/tone-analyzer/README.md +++ b/tone-analyzer/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - tone-analyzer - 5.1.1 + com.ibm.watson.developer_cloud + tone-analyzer + 5.1.1 ``` @@ -20,8 +20,7 @@ Use the [Tone Analyzer][tone_analyzer] service to get the tone of your email. ```java -final String VERSION_DATE = "2017-09-21"; -ToneAnalyzer service = new ToneAnalyzer(VERSION_DATE); +ToneAnalyzer service = new ToneAnalyzer("2017-09-21"); service.setUsernameAndPassword("", ""); String text = @@ -37,7 +36,10 @@ String text = + "business outcomes. Economy has nothing to do with it."; // Call the service and get the tone -ToneOptions toneOptions = new ToneOptions.Builder().html(text).build(); +ToneOptions toneOptions = new ToneOptions.Builder() + .html(text) + .build(); + ToneAnalysis tone = service.tone(toneOptions).execute(); System.out.println(tone); ``` diff --git a/visual-recognition/README.md b/visual-recognition/README.md index 49a6b4ad173..c17241a9959 100644 --- a/visual-recognition/README.md +++ b/visual-recognition/README.md @@ -5,9 +5,9 @@ ##### Maven ```xml - com.ibm.watson.developer_cloud - visual-recognition - 5.1.1 + com.ibm.watson.developer_cloud + visual-recognition + 5.1.1 ``` @@ -28,8 +28,8 @@ service.setApiKey(""); System.out.println("Classify an image"); ClassifyOptions options = new ClassifyOptions.Builder() - .imagesFile(new File(SINGLE_IMAGE_FILE)) - .build(); + .imagesFile(new File(SINGLE_IMAGE_FILE)) + .build(); ClassifiedImages result = service.classify(options).execute(); System.out.println(result); ```