From 3d1f731554fe9b800f225a4fce8561ea6409eaa7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 26 Jul 2018 11:48:45 -0700 Subject: [PATCH] [AutoPR cognitiveservices/data-plane/TextAnalytics] [Cognitive Services] Update endpoint URL template for TextAnalytics. (#2261) * Generated from a630b12320f25ed377697f8eb1c036b8e5965948 [cognitive Services] Update endpoint URL template for TextAnalytics. * Generated from a630b12320f25ed377697f8eb1c036b8e5965948 [cognitive Services] Update endpoint URL template for TextAnalytics. --- .../textanalytics/TextAnalyticsClient.java | 435 +++++++++ .../TextAnalyticsClientImpl.java | 830 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../textanalytics/models/BatchInput.java | 44 + .../models/DetectedLanguage.java | 97 ++ .../models/EntitiesBatchResult.java | 48 + .../models/EntitiesBatchResultItem.java | 48 + .../textanalytics/models/EntityRecord.java | 153 ++++ .../textanalytics/models/ErrorRecord.java | 69 ++ .../textanalytics/models/ErrorResponse.java | 121 +++ .../models/ErrorResponseException.java | 44 + .../language/textanalytics/models/Input.java | 69 ++ .../textanalytics/models/InternalError.java | 95 ++ .../models/KeyPhraseBatchResult.java | 48 + .../models/KeyPhraseBatchResultItem.java | 49 ++ .../models/LanguageBatchResult.java | 48 + .../models/LanguageBatchResultItem.java | 48 + .../textanalytics/models/MatchRecord.java | 95 ++ .../models/MultiLanguageBatchInput.java | 44 + .../models/MultiLanguageInput.java | 96 ++ .../models/SentimentBatchResult.java | 48 + .../models/SentimentBatchResultItem.java | 50 ++ .../textanalytics/models/package-info.java | 11 + .../language/textanalytics/package-info.java | 11 + .../textanalytics/TextAnalyticsClient.java | 435 +++++++++ .../TextAnalyticsClientImpl.java | 830 ++++++++++++++++++ .../implementation/package-info.java | 2 +- .../models/DetectedLanguage.java | 12 +- .../models/EntitiesBatchResultItem.java | 4 +- .../textanalytics/models/EntityRecord.java | 20 +- .../textanalytics/models/ErrorRecord.java | 8 +- .../language/textanalytics/models/Input.java | 4 +- .../models/KeyPhraseBatchResultItem.java | 4 +- .../models/LanguageBatchResultItem.java | 4 +- .../textanalytics/models/MatchRecord.java | 12 +- .../models/MultiLanguageInput.java | 8 +- .../models/SentimentBatchResultItem.java | 4 +- .../textanalytics/models/package-info.java | 2 +- .../language/textanalytics/package-info.java | 2 +- 39 files changed, 3920 insertions(+), 43 deletions(-) create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/BatchInput.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResult.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponse.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponseException.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/InternalError.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResult.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResult.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageBatchInput.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResult.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java create mode 100644 azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java create mode 100644 cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java create mode 100644 cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java new file mode 100644 index 0000000000000..1e9da3748598e --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java @@ -0,0 +1,435 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.Input; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.SentimentBatchResult; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * The interface for TextAnalyticsClient class. + */ +public interface TextAnalyticsClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + TextAnalyticsClient withEndpoint(String endpoint); + + /** + * Gets Gets or sets the preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets Gets or sets the preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + TextAnalyticsClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + TextAnalyticsClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + TextAnalyticsClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + KeyPhraseBatchResult keyPhrases(); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture keyPhrasesAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable keyPhrasesAsync(); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable> keyPhrasesWithServiceResponseAsync(); + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + KeyPhraseBatchResult keyPhrases(List documents); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture keyPhrasesAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable keyPhrasesAsync(List documents); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable> keyPhrasesWithServiceResponseAsync(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + LanguageBatchResult detectLanguage(); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture detectLanguageAsync(final ServiceCallback serviceCallback); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable detectLanguageAsync(); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable> detectLanguageWithServiceResponseAsync(); + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + LanguageBatchResult detectLanguage(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture detectLanguageAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable detectLanguageAsync(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable> detectLanguageWithServiceResponseAsync(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + SentimentBatchResult sentiment(); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture sentimentAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable sentimentAsync(); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable> sentimentWithServiceResponseAsync(); + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + SentimentBatchResult sentiment(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture sentimentAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable sentimentAsync(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable> sentimentWithServiceResponseAsync(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + EntitiesBatchResult entities(); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture entitiesAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable entitiesAsync(); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable> entitiesWithServiceResponseAsync(); + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + EntitiesBatchResult entities(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture entitiesAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable entitiesAsync(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable> entitiesWithServiceResponseAsync(List documents); + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java new file mode 100644 index 0000000000000..67b41d0a86d66 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java @@ -0,0 +1,830 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.implementation; + +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.BatchInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.Input; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageBatchInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.SentimentBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the TextAnalyticsClientImpl class. + */ +public class TextAnalyticsClientImpl extends AzureServiceClient implements TextAnalyticsClient { + /** The Retrofit service to perform REST calls. */ + private TextAnalyticsClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param credentials the management credentials for Azure + */ + public TextAnalyticsClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/text/analytics/v2.0", credentials); + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private TextAnalyticsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public TextAnalyticsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "TextAnalyticsClient", "v2.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(TextAnalyticsClientService.class); + } + + /** + * The interface defining all the services for TextAnalyticsClient to be + * used by Retrofit to perform actually REST calls. + */ + interface TextAnalyticsClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient keyPhrases" }) + @POST("keyPhrases") + Observable> keyPhrases(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient detectLanguage" }) + @POST("languages") + Observable> detectLanguage(@Header("accept-language") String acceptLanguage, @Body BatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient sentiment" }) + @POST("sentiment") + Observable> sentiment(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient entities" }) + @POST("entities") + Observable> entities(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + public KeyPhraseBatchResult keyPhrases() { + return keyPhrasesWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture keyPhrasesAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(keyPhrasesWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable keyPhrasesAsync() { + return keyPhrasesWithServiceResponseAsync().map(new Func1, KeyPhraseBatchResult>() { + @Override + public KeyPhraseBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable> keyPhrasesWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.keyPhrases(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = keyPhrasesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + public KeyPhraseBatchResult keyPhrases(List documents) { + return keyPhrasesWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture keyPhrasesAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(keyPhrasesWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable keyPhrasesAsync(List documents) { + return keyPhrasesWithServiceResponseAsync(documents).map(new Func1, KeyPhraseBatchResult>() { + @Override + public KeyPhraseBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable> keyPhrasesWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.keyPhrases(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = keyPhrasesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse keyPhrasesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + public LanguageBatchResult detectLanguage() { + return detectLanguageWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture detectLanguageAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectLanguageWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable detectLanguageAsync() { + return detectLanguageWithServiceResponseAsync().map(new Func1, LanguageBatchResult>() { + @Override + public LanguageBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable> detectLanguageWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + BatchInput input = new BatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.detectLanguage(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detectLanguageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + public LanguageBatchResult detectLanguage(List documents) { + return detectLanguageWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture detectLanguageAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectLanguageWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable detectLanguageAsync(List documents) { + return detectLanguageWithServiceResponseAsync(documents).map(new Func1, LanguageBatchResult>() { + @Override + public LanguageBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable> detectLanguageWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + BatchInput input = new BatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.detectLanguage(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detectLanguageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse detectLanguageDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + public SentimentBatchResult sentiment() { + return sentimentWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture sentimentAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(sentimentWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable sentimentAsync() { + return sentimentWithServiceResponseAsync().map(new Func1, SentimentBatchResult>() { + @Override + public SentimentBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable> sentimentWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.sentiment(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = sentimentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + public SentimentBatchResult sentiment(List documents) { + return sentimentWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture sentimentAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(sentimentWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable sentimentAsync(List documents) { + return sentimentWithServiceResponseAsync(documents).map(new Func1, SentimentBatchResult>() { + @Override + public SentimentBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable> sentimentWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.sentiment(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = sentimentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse sentimentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + public EntitiesBatchResult entities() { + return entitiesWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture entitiesAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable entitiesAsync() { + return entitiesWithServiceResponseAsync().map(new Func1, EntitiesBatchResult>() { + @Override + public EntitiesBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable> entitiesWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.entities(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = entitiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + public EntitiesBatchResult entities(List documents) { + return entitiesWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture entitiesAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable entitiesAsync(List documents) { + return entitiesWithServiceResponseAsync(documents).map(new Func1, EntitiesBatchResult>() { + @Override + public EntitiesBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable> entitiesWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.entities(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = entitiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse entitiesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java new file mode 100644 index 0000000000000..d11048c68da46 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.microsoft.azure.cognitiveservices.language.textanalytics.implementation; diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/BatchInput.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/BatchInput.java new file mode 100644 index 0000000000000..14edc26b8939c --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/BatchInput.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The BatchInput model. + */ +public class BatchInput { + /** + * The documents property. + */ + @JsonProperty(value = "documents") + private List documents; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Set the documents value. + * + * @param documents the documents value to set + * @return the BatchInput object itself. + */ + public BatchInput withDocuments(List documents) { + this.documents = documents; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java new file mode 100644 index 0000000000000..3dda91e445169 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The DetectedLanguage model. + */ +public class DetectedLanguage { + /** + * Long name of a detected language (e.g. English, French). + */ + @JsonProperty(value = "name") + private String name; + + /** + * A two letter representation of the detected language according to the + * ISO 639-1 standard (e.g. en, fr). + */ + @JsonProperty(value = "iso6391Name") + private String iso6391Name; + + /** + * A confidence score between 0 and 1. Scores close to 1 indicate 100% + * certainty that the identified language is true. + */ + @JsonProperty(value = "score") + private Double score; + + /** + * Get long name of a detected language (e.g. English, French). + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set long name of a detected language (e.g. English, French). + * + * @param name the name value to set + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage withName(String name) { + this.name = name; + return this; + } + + /** + * Get a two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + * + * @return the iso6391Name value + */ + public String iso6391Name() { + return this.iso6391Name; + } + + /** + * Set a two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + * + * @param iso6391Name the iso6391Name value to set + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage withIso6391Name(String iso6391Name) { + this.iso6391Name = iso6391Name; + return this; + } + + /** + * Get a confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + * + * @return the score value + */ + public Double score() { + return this.score; + } + + /** + * Set a confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + * + * @param score the score value to set + * @return the DetectedLanguage object itself. + */ + public DetectedLanguage withScore(Double score) { + this.score = score; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResult.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResult.java new file mode 100644 index 0000000000000..42ced0e3e3069 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResult.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The EntitiesBatchResult model. + */ +public class EntitiesBatchResult { + /** + * The documents property. + */ + @JsonProperty(value = "documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * The errors property. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java new file mode 100644 index 0000000000000..6284e7262cee6 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The EntitiesBatchResultItem model. + */ +public class EntitiesBatchResultItem { + /** + * Unique document identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Recognized entities in the document. + */ + @JsonProperty(value = "entities", access = JsonProperty.Access.WRITE_ONLY) + private List entities; + + /** + * Get unique document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get recognized entities in the document. + * + * @return the entities value + */ + public List entities() { + return this.entities; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java new file mode 100644 index 0000000000000..26e6a793ab0ae --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The EntityRecord model. + */ +public class EntityRecord { + /** + * Entity formal name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * List of instances this entity appears in the text. + */ + @JsonProperty(value = "matches", access = JsonProperty.Access.WRITE_ONLY) + private List matches; + + /** + * Wikipedia language for which the WikipediaId and WikipediaUrl refers to. + */ + @JsonProperty(value = "wikipediaLanguage") + private String wikipediaLanguage; + + /** + * Wikipedia unique identifier of the recognized entity. + */ + @JsonProperty(value = "wikipediaId") + private String wikipediaId; + + /** + * URL for the entity's English Wikipedia page. + */ + @JsonProperty(value = "wikipediaUrl", access = JsonProperty.Access.WRITE_ONLY) + private String wikipediaUrl; + + /** + * Bing unique identifier of the recognized entity. Use in conjunction with + * the Bing Entity Search API to fetch additional relevant information. + */ + @JsonProperty(value = "bingId") + private String bingId; + + /** + * Get entity formal name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set entity formal name. + * + * @param name the name value to set + * @return the EntityRecord object itself. + */ + public EntityRecord withName(String name) { + this.name = name; + return this; + } + + /** + * Get list of instances this entity appears in the text. + * + * @return the matches value + */ + public List matches() { + return this.matches; + } + + /** + * Get wikipedia language for which the WikipediaId and WikipediaUrl refers to. + * + * @return the wikipediaLanguage value + */ + public String wikipediaLanguage() { + return this.wikipediaLanguage; + } + + /** + * Set wikipedia language for which the WikipediaId and WikipediaUrl refers to. + * + * @param wikipediaLanguage the wikipediaLanguage value to set + * @return the EntityRecord object itself. + */ + public EntityRecord withWikipediaLanguage(String wikipediaLanguage) { + this.wikipediaLanguage = wikipediaLanguage; + return this; + } + + /** + * Get wikipedia unique identifier of the recognized entity. + * + * @return the wikipediaId value + */ + public String wikipediaId() { + return this.wikipediaId; + } + + /** + * Set wikipedia unique identifier of the recognized entity. + * + * @param wikipediaId the wikipediaId value to set + * @return the EntityRecord object itself. + */ + public EntityRecord withWikipediaId(String wikipediaId) { + this.wikipediaId = wikipediaId; + return this; + } + + /** + * Get uRL for the entity's English Wikipedia page. + * + * @return the wikipediaUrl value + */ + public String wikipediaUrl() { + return this.wikipediaUrl; + } + + /** + * Get bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. + * + * @return the bingId value + */ + public String bingId() { + return this.bingId; + } + + /** + * Set bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. + * + * @param bingId the bingId value to set + * @return the EntityRecord object itself. + */ + public EntityRecord withBingId(String bingId) { + this.bingId = bingId; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java new file mode 100644 index 0000000000000..3128dad8498d8 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ErrorRecord model. + */ +public class ErrorRecord { + /** + * Input document unique identifier the error refers to. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get input document unique identifier the error refers to. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set input document unique identifier the error refers to. + * + * @param id the id value to set + * @return the ErrorRecord object itself. + */ + public ErrorRecord withId(String id) { + this.id = id; + return this; + } + + /** + * Get error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message. + * + * @param message the message value to set + * @return the ErrorRecord object itself. + */ + public ErrorRecord withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponse.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponse.java new file mode 100644 index 0000000000000..1c163b8aa1d43 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponse.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ErrorResponse model. + */ +public class ErrorResponse { + /** + * The code property. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The target property. + */ + @JsonProperty(value = "target") + private String target; + + /** + * The innerError property. + */ + @JsonProperty(value = "innerError") + private InternalError innerError; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target value. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target value. + * + * @param target the target value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the innerError value. + * + * @return the innerError value + */ + public InternalError innerError() { + return this.innerError; + } + + /** + * Set the innerError value. + * + * @param innerError the innerError value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withInnerError(InternalError innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponseException.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponseException.java new file mode 100644 index 0000000000000..5023bd74f6a4d --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java new file mode 100644 index 0000000000000..7ab3c9ec12f8c --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Input model. + */ +public class Input { + /** + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The text property. + */ + @JsonProperty(value = "text") + private String text; + + /** + * Get unique, non-empty document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set unique, non-empty document identifier. + * + * @param id the id value to set + * @return the Input object itself. + */ + public Input withId(String id) { + this.id = id; + return this; + } + + /** + * Get the text value. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set the text value. + * + * @param text the text value to set + * @return the Input object itself. + */ + public Input withText(String text) { + this.text = text; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/InternalError.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/InternalError.java new file mode 100644 index 0000000000000..740a794584378 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/InternalError.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The InternalError model. + */ +public class InternalError { + /** + * The code property. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The innerError property. + */ + @JsonProperty(value = "innerError") + private InternalError innerError; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the InternalError object itself. + */ + public InternalError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the InternalError object itself. + */ + public InternalError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the innerError value. + * + * @return the innerError value + */ + public InternalError innerError() { + return this.innerError; + } + + /** + * Set the innerError value. + * + * @param innerError the innerError value to set + * @return the InternalError object itself. + */ + public InternalError withInnerError(InternalError innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResult.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResult.java new file mode 100644 index 0000000000000..cebf8c4dee013 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResult.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The KeyPhraseBatchResult model. + */ +public class KeyPhraseBatchResult { + /** + * The documents property. + */ + @JsonProperty(value = "documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * The errors property. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java new file mode 100644 index 0000000000000..95670cb35614a --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The KeyPhraseBatchResultItem model. + */ +public class KeyPhraseBatchResultItem { + /** + * A list of representative words or phrases. The number of key phrases + * returned is proportional to the number of words in the input document. + */ + @JsonProperty(value = "keyPhrases", access = JsonProperty.Access.WRITE_ONLY) + private List keyPhrases; + + /** + * Unique document identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get a list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + * + * @return the keyPhrases value + */ + public List keyPhrases() { + return this.keyPhrases; + } + + /** + * Get unique document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResult.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResult.java new file mode 100644 index 0000000000000..51f59cb76c9f8 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResult.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The LanguageBatchResult model. + */ +public class LanguageBatchResult { + /** + * The documents property. + */ + @JsonProperty(value = "documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * The errors property. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java new file mode 100644 index 0000000000000..39fb7c0cd0739 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The LanguageBatchResultItem model. + */ +public class LanguageBatchResultItem { + /** + * Unique document identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * A list of extracted languages. + */ + @JsonProperty(value = "detectedLanguages", access = JsonProperty.Access.WRITE_ONLY) + private List detectedLanguages; + + /** + * Get unique document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get a list of extracted languages. + * + * @return the detectedLanguages value + */ + public List detectedLanguages() { + return this.detectedLanguages; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java new file mode 100644 index 0000000000000..633b10359375e --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MatchRecord model. + */ +public class MatchRecord { + /** + * Entity text as appears in the request. + */ + @JsonProperty(value = "text") + private String text; + + /** + * Start position (in Unicode characters) for the entity match text. + */ + @JsonProperty(value = "offset") + private Integer offset; + + /** + * Length (in Unicode characters) for the entity match text. + */ + @JsonProperty(value = "length") + private Integer length; + + /** + * Get entity text as appears in the request. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set entity text as appears in the request. + * + * @param text the text value to set + * @return the MatchRecord object itself. + */ + public MatchRecord withText(String text) { + this.text = text; + return this; + } + + /** + * Get start position (in Unicode characters) for the entity match text. + * + * @return the offset value + */ + public Integer offset() { + return this.offset; + } + + /** + * Set start position (in Unicode characters) for the entity match text. + * + * @param offset the offset value to set + * @return the MatchRecord object itself. + */ + public MatchRecord withOffset(Integer offset) { + this.offset = offset; + return this; + } + + /** + * Get length (in Unicode characters) for the entity match text. + * + * @return the length value + */ + public Integer length() { + return this.length; + } + + /** + * Set length (in Unicode characters) for the entity match text. + * + * @param length the length value to set + * @return the MatchRecord object itself. + */ + public MatchRecord withLength(Integer length) { + this.length = length; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageBatchInput.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageBatchInput.java new file mode 100644 index 0000000000000..d91b84a9d447f --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageBatchInput.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MultiLanguageBatchInput model. + */ +public class MultiLanguageBatchInput { + /** + * The documents property. + */ + @JsonProperty(value = "documents") + private List documents; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Set the documents value. + * + * @param documents the documents value to set + * @return the MultiLanguageBatchInput object itself. + */ + public MultiLanguageBatchInput withDocuments(List documents) { + this.documents = documents; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java new file mode 100644 index 0000000000000..cc67780a7455c --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MultiLanguageInput model. + */ +public class MultiLanguageInput { + /** + * This is the 2 letter ISO 639-1 representation of a language. For + * example, use "en" for English; "es" for Spanish etc.,. + */ + @JsonProperty(value = "language") + private String language; + + /** + * Unique, non-empty document identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The text property. + */ + @JsonProperty(value = "text") + private String text; + + /** + * Get this is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc.,. + * + * @return the language value + */ + public String language() { + return this.language; + } + + /** + * Set this is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc.,. + * + * @param language the language value to set + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput withLanguage(String language) { + this.language = language; + return this; + } + + /** + * Get unique, non-empty document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set unique, non-empty document identifier. + * + * @param id the id value to set + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput withId(String id) { + this.id = id; + return this; + } + + /** + * Get the text value. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set the text value. + * + * @param text the text value to set + * @return the MultiLanguageInput object itself. + */ + public MultiLanguageInput withText(String text) { + this.text = text; + return this; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResult.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResult.java new file mode 100644 index 0000000000000..c1df7249d42ae --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResult.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SentimentBatchResult model. + */ +public class SentimentBatchResult { + /** + * The documents property. + */ + @JsonProperty(value = "documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * The errors property. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * Get the documents value. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java new file mode 100644 index 0000000000000..850bba7ddbe01 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SentimentBatchResultItem model. + */ +public class SentimentBatchResultItem { + /** + * A decimal number between 0 and 1 denoting the sentiment of the document. + * A score above 0.7 usually refers to a positive document while a score + * below 0.3 normally has a negative connotation. Mid values refer to + * neutral text. + */ + @JsonProperty(value = "score", access = JsonProperty.Access.WRITE_ONLY) + private Double score; + + /** + * Unique document identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get a decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text. + * + * @return the score value + */ + public Double score() { + return this.score; + } + + /** + * Get unique document identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + +} diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java new file mode 100644 index 0000000000000..7a370ed9e1da7 --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the models classes for TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.microsoft.azure.cognitiveservices.language.textanalytics.models; diff --git a/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java new file mode 100644 index 0000000000000..19ef097e2c69b --- /dev/null +++ b/azure-cognitiveservices/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for TextAnalyticsClient. + * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + */ +package com.microsoft.azure.cognitiveservices.language.textanalytics; diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java new file mode 100644 index 0000000000000..1e9da3748598e --- /dev/null +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/TextAnalyticsClient.java @@ -0,0 +1,435 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.Input; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.SentimentBatchResult; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * The interface for TextAnalyticsClient class. + */ +public interface TextAnalyticsClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + TextAnalyticsClient withEndpoint(String endpoint); + + /** + * Gets Gets or sets the preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets Gets or sets the preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + TextAnalyticsClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + TextAnalyticsClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + TextAnalyticsClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + KeyPhraseBatchResult keyPhrases(); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture keyPhrasesAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable keyPhrasesAsync(); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable> keyPhrasesWithServiceResponseAsync(); + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + KeyPhraseBatchResult keyPhrases(List documents); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture keyPhrasesAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable keyPhrasesAsync(List documents); + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + Observable> keyPhrasesWithServiceResponseAsync(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + LanguageBatchResult detectLanguage(); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture detectLanguageAsync(final ServiceCallback serviceCallback); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable detectLanguageAsync(); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable> detectLanguageWithServiceResponseAsync(); + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + LanguageBatchResult detectLanguage(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture detectLanguageAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable detectLanguageAsync(List documents); + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + Observable> detectLanguageWithServiceResponseAsync(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + SentimentBatchResult sentiment(); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture sentimentAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable sentimentAsync(); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable> sentimentWithServiceResponseAsync(); + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + SentimentBatchResult sentiment(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture sentimentAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable sentimentAsync(List documents); + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + Observable> sentimentWithServiceResponseAsync(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + EntitiesBatchResult entities(); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture entitiesAsync(final ServiceCallback serviceCallback); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable entitiesAsync(); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable> entitiesWithServiceResponseAsync(); + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + EntitiesBatchResult entities(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture entitiesAsync(List documents, final ServiceCallback serviceCallback); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable entitiesAsync(List documents); + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + Observable> entitiesWithServiceResponseAsync(List documents); + +} diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java new file mode 100644 index 0000000000000..67b41d0a86d66 --- /dev/null +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsClientImpl.java @@ -0,0 +1,830 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.language.textanalytics.implementation; + +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.BatchInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.EntitiesBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.Input; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.KeyPhraseBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.LanguageBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageBatchInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.MultiLanguageInput; +import com.microsoft.azure.cognitiveservices.language.textanalytics.models.SentimentBatchResult; +import com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the TextAnalyticsClientImpl class. + */ +public class TextAnalyticsClientImpl extends AzureServiceClient implements TextAnalyticsClient { + /** The Retrofit service to perform REST calls. */ + private TextAnalyticsClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public TextAnalyticsClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param credentials the management credentials for Azure + */ + public TextAnalyticsClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/text/analytics/v2.0", credentials); + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private TextAnalyticsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of TextAnalyticsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public TextAnalyticsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "TextAnalyticsClient", "v2.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(TextAnalyticsClientService.class); + } + + /** + * The interface defining all the services for TextAnalyticsClient to be + * used by Retrofit to perform actually REST calls. + */ + interface TextAnalyticsClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient keyPhrases" }) + @POST("keyPhrases") + Observable> keyPhrases(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient detectLanguage" }) + @POST("languages") + Observable> detectLanguage(@Header("accept-language") String acceptLanguage, @Body BatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient sentiment" }) + @POST("sentiment") + Observable> sentiment(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.language.textanalytics.TextAnalyticsClient entities" }) + @POST("entities") + Observable> entities(@Header("accept-language") String acceptLanguage, @Body MultiLanguageBatchInput input, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + public KeyPhraseBatchResult keyPhrases() { + return keyPhrasesWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture keyPhrasesAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(keyPhrasesWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable keyPhrasesAsync() { + return keyPhrasesWithServiceResponseAsync().map(new Func1, KeyPhraseBatchResult>() { + @Override + public KeyPhraseBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable> keyPhrasesWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.keyPhrases(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = keyPhrasesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KeyPhraseBatchResult object if successful. + */ + public KeyPhraseBatchResult keyPhrases(List documents) { + return keyPhrasesWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture keyPhrasesAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(keyPhrasesWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable keyPhrasesAsync(List documents) { + return keyPhrasesWithServiceResponseAsync(documents).map(new Func1, KeyPhraseBatchResult>() { + @Override + public KeyPhraseBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of strings denoting the key talking points in the input text. + * See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeyPhraseBatchResult object + */ + public Observable> keyPhrasesWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.keyPhrases(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = keyPhrasesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse keyPhrasesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + public LanguageBatchResult detectLanguage() { + return detectLanguageWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture detectLanguageAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectLanguageWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable detectLanguageAsync() { + return detectLanguageWithServiceResponseAsync().map(new Func1, LanguageBatchResult>() { + @Override + public LanguageBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable> detectLanguageWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + BatchInput input = new BatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.detectLanguage(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detectLanguageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LanguageBatchResult object if successful. + */ + public LanguageBatchResult detectLanguage(List documents) { + return detectLanguageWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture detectLanguageAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectLanguageWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable detectLanguageAsync(List documents) { + return detectLanguageWithServiceResponseAsync(documents).map(new Func1, LanguageBatchResult>() { + @Override + public LanguageBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns the detected language and a numeric score between 0 and 1. + * Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. + * + * @param documents the List<Input> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LanguageBatchResult object + */ + public Observable> detectLanguageWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + BatchInput input = new BatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.detectLanguage(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = detectLanguageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse detectLanguageDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + public SentimentBatchResult sentiment() { + return sentimentWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture sentimentAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(sentimentWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable sentimentAsync() { + return sentimentWithServiceResponseAsync().map(new Func1, SentimentBatchResult>() { + @Override + public SentimentBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable> sentimentWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.sentiment(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = sentimentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SentimentBatchResult object if successful. + */ + public SentimentBatchResult sentiment(List documents) { + return sentimentWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture sentimentAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(sentimentWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable sentimentAsync(List documents) { + return sentimentWithServiceResponseAsync(documents).map(new Func1, SentimentBatchResult>() { + @Override + public SentimentBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a numeric score between 0 and 1. + * Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SentimentBatchResult object + */ + public Observable> sentimentWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.sentiment(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = sentimentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse sentimentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + public EntitiesBatchResult entities() { + return entitiesWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture entitiesAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(), serviceCallback); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable entitiesAsync() { + return entitiesWithServiceResponseAsync().map(new Func1, EntitiesBatchResult>() { + @Override + public EntitiesBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable> entitiesWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + final List documents = null; + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.entities(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = entitiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EntitiesBatchResult object if successful. + */ + public EntitiesBatchResult entities(List documents) { + return entitiesWithServiceResponseAsync(documents).toBlocking().single().body(); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture entitiesAsync(List documents, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(documents), serviceCallback); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable entitiesAsync(List documents) { + return entitiesWithServiceResponseAsync(documents).map(new Func1, EntitiesBatchResult>() { + @Override + public EntitiesBatchResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The API returns a list of recognized entities in a given document. + * To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported languages in Text Analytics API</a> for the list of enabled languages. + * + * @param documents the List<MultiLanguageInput> value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EntitiesBatchResult object + */ + public Observable> entitiesWithServiceResponseAsync(List documents) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + Validator.validate(documents); + MultiLanguageBatchInput input = new MultiLanguageBatchInput(); + input.withDocuments(documents); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.entities(this.acceptLanguage(), input, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = entitiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse entitiesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java index 3e9e5b573a4f3..d11048c68da46 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for TextAnalyticsAPI. + * This package contains the implementation classes for TextAnalyticsClient. * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. */ package com.microsoft.azure.cognitiveservices.language.textanalytics.implementation; diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java index d122c985813dd..3dda91e445169 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/DetectedLanguage.java @@ -35,7 +35,7 @@ public class DetectedLanguage { private Double score; /** - * Get the name value. + * Get long name of a detected language (e.g. English, French). * * @return the name value */ @@ -44,7 +44,7 @@ public String name() { } /** - * Set the name value. + * Set long name of a detected language (e.g. English, French). * * @param name the name value to set * @return the DetectedLanguage object itself. @@ -55,7 +55,7 @@ public DetectedLanguage withName(String name) { } /** - * Get the iso6391Name value. + * Get a two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). * * @return the iso6391Name value */ @@ -64,7 +64,7 @@ public String iso6391Name() { } /** - * Set the iso6391Name value. + * Set a two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). * * @param iso6391Name the iso6391Name value to set * @return the DetectedLanguage object itself. @@ -75,7 +75,7 @@ public DetectedLanguage withIso6391Name(String iso6391Name) { } /** - * Get the score value. + * Get a confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. * * @return the score value */ @@ -84,7 +84,7 @@ public Double score() { } /** - * Set the score value. + * Set a confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. * * @param score the score value to set * @return the DetectedLanguage object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java index 48c15e0c425d4..6284e7262cee6 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntitiesBatchResultItem.java @@ -28,7 +28,7 @@ public class EntitiesBatchResultItem { private List entities; /** - * Get the id value. + * Get unique document identifier. * * @return the id value */ @@ -37,7 +37,7 @@ public String id() { } /** - * Get the entities value. + * Get recognized entities in the document. * * @return the entities value */ diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java index 84163bb714c8e..26e6a793ab0ae 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/EntityRecord.java @@ -53,7 +53,7 @@ public class EntityRecord { private String bingId; /** - * Get the name value. + * Get entity formal name. * * @return the name value */ @@ -62,7 +62,7 @@ public String name() { } /** - * Set the name value. + * Set entity formal name. * * @param name the name value to set * @return the EntityRecord object itself. @@ -73,7 +73,7 @@ public EntityRecord withName(String name) { } /** - * Get the matches value. + * Get list of instances this entity appears in the text. * * @return the matches value */ @@ -82,7 +82,7 @@ public List matches() { } /** - * Get the wikipediaLanguage value. + * Get wikipedia language for which the WikipediaId and WikipediaUrl refers to. * * @return the wikipediaLanguage value */ @@ -91,7 +91,7 @@ public String wikipediaLanguage() { } /** - * Set the wikipediaLanguage value. + * Set wikipedia language for which the WikipediaId and WikipediaUrl refers to. * * @param wikipediaLanguage the wikipediaLanguage value to set * @return the EntityRecord object itself. @@ -102,7 +102,7 @@ public EntityRecord withWikipediaLanguage(String wikipediaLanguage) { } /** - * Get the wikipediaId value. + * Get wikipedia unique identifier of the recognized entity. * * @return the wikipediaId value */ @@ -111,7 +111,7 @@ public String wikipediaId() { } /** - * Set the wikipediaId value. + * Set wikipedia unique identifier of the recognized entity. * * @param wikipediaId the wikipediaId value to set * @return the EntityRecord object itself. @@ -122,7 +122,7 @@ public EntityRecord withWikipediaId(String wikipediaId) { } /** - * Get the wikipediaUrl value. + * Get uRL for the entity's English Wikipedia page. * * @return the wikipediaUrl value */ @@ -131,7 +131,7 @@ public String wikipediaUrl() { } /** - * Get the bingId value. + * Get bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. * * @return the bingId value */ @@ -140,7 +140,7 @@ public String bingId() { } /** - * Set the bingId value. + * Set bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. * * @param bingId the bingId value to set * @return the EntityRecord object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java index fa098846ce7bc..3128dad8498d8 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/ErrorRecord.java @@ -27,7 +27,7 @@ public class ErrorRecord { private String message; /** - * Get the id value. + * Get input document unique identifier the error refers to. * * @return the id value */ @@ -36,7 +36,7 @@ public String id() { } /** - * Set the id value. + * Set input document unique identifier the error refers to. * * @param id the id value to set * @return the ErrorRecord object itself. @@ -47,7 +47,7 @@ public ErrorRecord withId(String id) { } /** - * Get the message value. + * Get error message. * * @return the message value */ @@ -56,7 +56,7 @@ public String message() { } /** - * Set the message value. + * Set error message. * * @param message the message value to set * @return the ErrorRecord object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java index 0f6490feb4640..7ab3c9ec12f8c 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/Input.java @@ -27,7 +27,7 @@ public class Input { private String text; /** - * Get the id value. + * Get unique, non-empty document identifier. * * @return the id value */ @@ -36,7 +36,7 @@ public String id() { } /** - * Set the id value. + * Set unique, non-empty document identifier. * * @param id the id value to set * @return the Input object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java index 4f41d2807e972..95670cb35614a 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/KeyPhraseBatchResultItem.java @@ -29,7 +29,7 @@ public class KeyPhraseBatchResultItem { private String id; /** - * Get the keyPhrases value. + * Get a list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. * * @return the keyPhrases value */ @@ -38,7 +38,7 @@ public List keyPhrases() { } /** - * Get the id value. + * Get unique document identifier. * * @return the id value */ diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java index c935334df42e4..39fb7c0cd0739 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/LanguageBatchResultItem.java @@ -28,7 +28,7 @@ public class LanguageBatchResultItem { private List detectedLanguages; /** - * Get the id value. + * Get unique document identifier. * * @return the id value */ @@ -37,7 +37,7 @@ public String id() { } /** - * Get the detectedLanguages value. + * Get a list of extracted languages. * * @return the detectedLanguages value */ diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java index 600c0e56d5eb5..633b10359375e 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MatchRecord.java @@ -33,7 +33,7 @@ public class MatchRecord { private Integer length; /** - * Get the text value. + * Get entity text as appears in the request. * * @return the text value */ @@ -42,7 +42,7 @@ public String text() { } /** - * Set the text value. + * Set entity text as appears in the request. * * @param text the text value to set * @return the MatchRecord object itself. @@ -53,7 +53,7 @@ public MatchRecord withText(String text) { } /** - * Get the offset value. + * Get start position (in Unicode characters) for the entity match text. * * @return the offset value */ @@ -62,7 +62,7 @@ public Integer offset() { } /** - * Set the offset value. + * Set start position (in Unicode characters) for the entity match text. * * @param offset the offset value to set * @return the MatchRecord object itself. @@ -73,7 +73,7 @@ public MatchRecord withOffset(Integer offset) { } /** - * Get the length value. + * Get length (in Unicode characters) for the entity match text. * * @return the length value */ @@ -82,7 +82,7 @@ public Integer length() { } /** - * Set the length value. + * Set length (in Unicode characters) for the entity match text. * * @param length the length value to set * @return the MatchRecord object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java index 0367e20c33d32..cc67780a7455c 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/MultiLanguageInput.java @@ -34,7 +34,7 @@ public class MultiLanguageInput { private String text; /** - * Get the language value. + * Get this is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc.,. * * @return the language value */ @@ -43,7 +43,7 @@ public String language() { } /** - * Set the language value. + * Set this is the 2 letter ISO 639-1 representation of a language. For example, use "en" for English; "es" for Spanish etc.,. * * @param language the language value to set * @return the MultiLanguageInput object itself. @@ -54,7 +54,7 @@ public MultiLanguageInput withLanguage(String language) { } /** - * Get the id value. + * Get unique, non-empty document identifier. * * @return the id value */ @@ -63,7 +63,7 @@ public String id() { } /** - * Set the id value. + * Set unique, non-empty document identifier. * * @param id the id value to set * @return the MultiLanguageInput object itself. diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java index 54c880e209db6..850bba7ddbe01 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/SentimentBatchResultItem.java @@ -30,7 +30,7 @@ public class SentimentBatchResultItem { private String id; /** - * Get the score value. + * Get a decimal number between 0 and 1 denoting the sentiment of the document. A score above 0.7 usually refers to a positive document while a score below 0.3 normally has a negative connotation. Mid values refer to neutral text. * * @return the score value */ @@ -39,7 +39,7 @@ public Double score() { } /** - * Get the id value. + * Get unique document identifier. * * @return the id value */ diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java index bd3e3ab77f4bb..7a370ed9e1da7 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/models/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the models classes for TextAnalyticsAPI. + * This package contains the models classes for TextAnalyticsClient. * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. */ package com.microsoft.azure.cognitiveservices.language.textanalytics.models; diff --git a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java index 3025a2e6cb44c..19ef097e2c69b 100755 --- a/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java +++ b/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for TextAnalyticsAPI. + * This package contains the classes for TextAnalyticsClient. * The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. No training data is needed to use this API; just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. */ package com.microsoft.azure.cognitiveservices.language.textanalytics;