diff --git a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java index d43270cc3354..3a5e37dc42f7 100644 --- a/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java +++ b/sdk/translation/azure-ai-translation-text/src/main/java/com/azure/ai/translation/text/TextTranslationAsyncClient.java @@ -1,20 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. + package com.azure.ai.translation.text; import com.azure.ai.translation.text.implementation.TextTranslationClientImpl; -import com.azure.ai.translation.text.models.BreakSentenceItem; -import com.azure.ai.translation.text.models.DictionaryExampleItem; -import com.azure.ai.translation.text.models.DictionaryExampleTextItem; -import com.azure.ai.translation.text.models.DictionaryLookupItem; import com.azure.ai.translation.text.models.GetSupportedLanguagesResult; import com.azure.ai.translation.text.models.InputTextItem; -import com.azure.ai.translation.text.models.LanguageScope; -import com.azure.ai.translation.text.models.ProfanityAction; -import com.azure.ai.translation.text.models.ProfanityMarker; -import com.azure.ai.translation.text.models.TextType; -import com.azure.ai.translation.text.models.TranslateOptions; +import com.azure.ai.translation.text.models.TranslateBodyDetails; import com.azure.ai.translation.text.models.TranslatedTextItem; import com.azure.ai.translation.text.models.TransliteratedText; import com.azure.core.annotation.Generated; @@ -31,8 +24,6 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; import com.azure.core.util.serializer.TypeReference; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import reactor.core.publisher.Mono; @@ -41,13 +32,12 @@ */ @ServiceClient(builder = TextTranslationClientBuilder.class, isAsync = true) public final class TextTranslationAsyncClient { - @Generated private final TextTranslationClientImpl serviceClient; /** * Initializes an instance of TextTranslationAsyncClient class. - * + * * @param serviceClient the service client implementation. */ @Generated @@ -56,54 +46,17 @@ public final class TextTranslationAsyncClient { } /** - * Translate Text. + * Gets the set of languages currently supported by other operations of the Translator. *
Query Parameters
*Name | Type | Required | Description |
---|---|---|---|
from | String | No | Specifies the language of the input text. Find which languages are - * available to translate from by - * looking up supported languages using the translation scope. If the from parameter isn't specified, - * automatic language detection is applied to determine the source language. - * - * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. - * Note: the dynamic dictionary feature is case-sensitive. |
textType | String | No | Defines whether the text being translated is plain text or - * HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". |
category | String | No | A string specifying the category (domain) of the translation. - * This parameter is used to get translations - * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator - * project details to this parameter to use your deployed customized system. Default value is: general. |
profanityAction | String | No | Specifies how profanities should be treated in - * translations. - * Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction", "Marked", - * "Deleted". |
profanityMarker | String | No | Specifies how profanities should be marked in - * translations. - * Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk", "Tag". |
includeAlignment | Boolean | No | Specifies whether to include alignment projection - * from source text to translated text. - * Possible values are: true or false (default). |
includeSentenceLength | Boolean | No | Specifies whether to include sentence boundaries - * for the input text and the translated text. - * Possible values are: true or false (default). |
suggestedFrom | String | No | Specifies a fallback language if the language of the - * input text can't be identified. - * Language autodetection is applied when the from parameter is omitted. If detection fails, - * the suggestedFrom language will be assumed. |
fromScript | String | No | Specifies the script of the input text. |
toScript | String | No | Specifies the script of the translated text. |
allowFallback | Boolean | No | Specifies that the service is allowed to fall back to a - * general system when a custom system doesn't exist. - * Possible values are: true (default) or false. - * - * allowFallback=false specifies that the translation should only use systems trained for the category specified - * by the request. If a translation for language X to language Y requires chaining through a pivot language E, - * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. - * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true - * specifies that the service is allowed to fall back to a general system when a custom system doesn't - * exist. |
scope | String | No | A comma-separated list of names defining the group of languages + * to return. + * Allowed group names are: `translation`, `transliteration` and `dictionary`. + * If no scope is given, then all groups are returned, which is equivalent to passing + * `scope=translation,transliteration,dictionary`. To decide which set of supported languages + * is appropriate for your scenario, see the description of the [response object](#response-body). |
Header Parameters
@@ -112,6 +65,94 @@ public final class TextTranslationAsyncClient { *Response Body Schema
+ * + *+ * {@code + * { + * translation (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * } + * } + * transliteration (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * scripts (Required): [ + * (Required){ + * code: String (Required) + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * toScripts (Required): [ + * (Required){ + * code: String (Required) + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * } + * ] + * } + * ] + * } + * } + * dictionary (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * translations (Required): [ + * (Required){ + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * code: String (Required) + * } + * ] + * } + * } + * } + * } + *+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the set of languages currently supported by other operations of the Translator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono
Header Parameters
+ *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the + * request. |
Request Body Schema
@@ -121,6 +162,31 @@ public final class TextTranslationAsyncClient { * [ * (Required){ * text: String (Required) + * script: String (Optional) + * language: String (Optional) + * textType: String(Plain/Html) (Optional) + * targets (Required): [ + * (Required){ + * language (Required): [ + * String (Required) + * ] + * script: String (Optional) + * profanityAction: String(NoAction/Marked/Deleted) (Optional) + * profanityMarker: String(Asterisk/Tag) (Optional) + * deploymentNameModel: String (Optional) + * allowFallback: Boolean (Optional) + * grade: String (Optional) + * tone: String (Optional) + * gender: String (Optional) + * adaptiveDatasetId: String (Optional) + * referenceTextPairs (Optional): [ + * (Optional){ + * referenceTextPairsSource: String (Required) + * referenceTextPairsTarget: String (Required) + * } + * ] + * } + * ] * } * ] * } @@ -144,17 +210,6 @@ public final class TextTranslationAsyncClient { * text: String (Required) * script: String (Required) * } - * alignment (Optional): { - * proj: String (Required) - * } - * sentLen (Optional): { - * srcSentLen (Required): [ - * int (Required) - * ] - * transSentLen (Required): [ - * int (Required) - * ] - * } * } * ] * sourceText (Optional): { @@ -164,12 +219,7 @@ public final class TextTranslationAsyncClient { * ] * } * - * - * @param targetLanguages Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. + * * @param body Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -180,9 +230,8 @@ public final class TextTranslationAsyncClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public MonoQuery Parameters
- *Name | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. |
script | String | No | Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
+ * Gets the set of languages currently supported by other operations of the Translator. * - *- * {@code - * [ - * (Required){ - * detectedLanguage (Optional): { - * language: String (Required) - * score: double (Required) - * } - * sentLen (Required): [ - * int (Required) - * ] - * } - * ] - * } - *- * - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param clientTraceId A client-generated GUID to uniquely identify the request. + * @param scope A comma-separated list of names defining the group of languages to return. + * Allowed group names are: `translation`, `transliteration` and `dictionary`. + * If no scope is given, then all groups are returned, which is equivalent to passing + * `scope=translation,transliteration,dictionary`. To decide which set of supported languages + * is appropriate for your scenario, see the description of the [response object](#response-body). + * @param acceptLanguage The language to use for user interface strings. Some of the fields in the response are + * names of languages or + * names of regions. Use this parameter to define the language in which these names are returned. + * The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` + * to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. + * Names are provided in the English language when a target language is not specified or when localization + * is not available. + * @param ifNoneMatch Passing the value of the ETag response header in an If-None-Match field will allow the service + * to optimize the response. + * If the resource has not been modified, the service will return status code 304 and an empty response body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of languages currently supported by other operations of the Translator on successful completion + * of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *+ * Gets the set of languages currently supported by other operations of the Translator. * - *
Response Body Schema
+ * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of languages currently supported by other operations of the Translator on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * displaySource: String (Required) - * translations (Required): [ - * (Required){ - * normalizedTarget: String (Required) - * displayTarget: String (Required) - * posTag: String (Required) - * confidence: double (Required) - * prefixWord: String (Required) - * backTranslations (Required): [ - * (Required){ - * normalizedText: String (Required) - * displayText: String (Required) - * numExamples: int (Required) - * frequencyCount: int (Required) - * } - * ] - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param clientTraceId A client-generated GUID to uniquely identify the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * translation: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * normalizedTarget: String (Required) - * examples (Required): [ - * (Required){ - * sourcePrefix: String (Required) - * sourceTerm: String (Required) - * sourceSuffix: String (Required) - * targetPrefix: String (Required) - * targetTerm: String (Required) - * targetSuffix: String (Required) - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
- * This method is used when you have single target language and multiple texts to translate. - *
- * - * @param targetLanguage Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have single target language and single text to translate. - *
- * - * @param targetLanguage Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have one input text and the optional parameters are needed such as specification - * of a source language, profanity handling etc. - *
- * - * @param text Text to translate. - * @param translateOptions Translate Options. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have multiple texts and the optional parameters are needed such as specification - * of a source language, profanity handling etc.. - *
- * - * @param texts List of text to translate. - * @param translateOptions Translate Options. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have multiple texts to transliterate and you want to provide client trace id. - *
- * - * @param language Specifies the language of the text to convert from one script to another. - * Possible languages are listed in the transliteration scope obtained by querying the service - * for its supported languages. - * @param sourceLanguageScript Specifies the script used by the input text. Look up supported languages using the - * transliteration scope, - * to find input scripts available for the selected language. - * @param targetLanguageScript Specifies the output script. Look up supported languages using the transliteration - * scope, to find output - * scripts available for the selected combination of input language and input script. - * @param body Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have single text to transliterate and you want to provide client trace id. - *
- * + * * @param language Specifies the language of the text to convert from one script to another. * Possible languages are listed in the transliteration scope obtained by querying the service * for its supported languages. @@ -759,256 +458,6 @@ public Mono- * This method is used when you have multiple texts for which you want to find sentence boundaries and you want to - * provide - * client trace id. - *
- * - * @param texts Defines the content of the request. - * @param language Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. - * @param script Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have single text for which you want to find sentence boundaries and you want to - * provide - * client trace id. - *
- * - * @param text Defines the content of the request. - * @param language Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. - * @param script Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have multiple texts for which you want to find sentence boundaries and you want - * the source language to be auto-detected by the service. - *
- * - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you have single text for which you want to find sentence boundaries and you want - * the source language to be auto-detected by the service. - *
- * - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you want lookup multiple entries in the dictionary and you want to provide - * client trace id. - *
- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono- * This method is used when you want lookup single entry in the dictionary and you want to provide - * client trace id. - *
- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public MonoQuery Parameters
- *Name | Type | Required | Description |
---|---|---|---|
scope | String | No | A comma-separated list of names defining the group of languages - * to return. - * Allowed group names are: `translation`, `transliteration` and `dictionary`. - * If no scope is given, then all groups are returned, which is equivalent to passing - * `scope=translation,transliteration,dictionary`. To decide which set of supported languages - * is appropriate for your scenario, see the description of the [response object](#response-body). |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Accept-Language | String | No | The language to use for user interface strings. Some of - * the fields in the response are names of languages or - * names of regions. Use this parameter to define the language in which these names are returned. - * The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - * to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - * Names are provided in the English language when a target language is not specified or when localization - * is not available. |
If-None-Match | String | No | Passing the value of the ETag response header in an - * If-None-Match field will allow the service to optimize the response. - * If the resource has not been modified, the service will return status code 304 and an empty response - * body. |
Response Body Schema
- * - *- * {@code - * { - * translation (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * } - * } - * transliteration (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * scripts (Required): [ - * (Required){ - * code: String (Required) - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * toScripts (Required): [ - * (Required){ - * code: String (Required) - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * } - * ] - * } - * ] - * } - * } - * dictionary (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * translations (Required): [ - * (Required){ - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * code: String (Required) - * } - * ] - * } - * } - * } - * } - *- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the set of languages currently supported by other operations of the Translator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Query Parameters
*Name | Type | Required | Description |
---|---|---|---|
from | String | No | Specifies the language of the input text. Find which languages are - * available to translate from by - * looking up supported languages using the translation scope. If the from parameter isn't specified, - * automatic language detection is applied to determine the source language. - * - * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. - * Note: the dynamic dictionary feature is case-sensitive. |
textType | String | No | Defines whether the text being translated is plain text or - * HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". |
category | String | No | A string specifying the category (domain) of the translation. - * This parameter is used to get translations - * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator - * project details to this parameter to use your deployed customized system. Default value is: general. |
profanityAction | String | No | Specifies how profanities should be treated in - * translations. - * Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction", "Marked", - * "Deleted". |
profanityMarker | String | No | Specifies how profanities should be marked in - * translations. - * Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk", "Tag". |
includeAlignment | Boolean | No | Specifies whether to include alignment projection - * from source text to translated text. - * Possible values are: true or false (default). |
includeSentenceLength | Boolean | No | Specifies whether to include sentence boundaries - * for the input text and the translated text. - * Possible values are: true or false (default). |
suggestedFrom | String | No | Specifies a fallback language if the language of the - * input text can't be identified. - * Language autodetection is applied when the from parameter is omitted. If detection fails, - * the suggestedFrom language will be assumed. |
fromScript | String | No | Specifies the script of the input text. |
toScript | String | No | Specifies the script of the translated text. |
allowFallback | Boolean | No | Specifies that the service is allowed to fall back to a - * general system when a custom system doesn't exist. - * Possible values are: true (default) or false. - * - * allowFallback=false specifies that the translation should only use systems trained for the category specified - * by the request. If a translation for language X to language Y requires chaining through a pivot language E, - * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. - * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true - * specifies that the service is allowed to fall back to a general system when a custom system doesn't - * exist. |
scope | String | No | A comma-separated list of names defining the group of languages + * to return. + * Allowed group names are: `translation`, `transliteration` and `dictionary`. + * If no scope is given, then all groups are returned, which is equivalent to passing + * `scope=translation,transliteration,dictionary`. To decide which set of supported languages + * is appropriate for your scenario, see the description of the [response object](#response-body). |
Header Parameters
@@ -110,6 +63,94 @@ public final class TextTranslationClient { *Response Body Schema
+ * + *+ * {@code + * { + * translation (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * } + * } + * transliteration (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * scripts (Required): [ + * (Required){ + * code: String (Required) + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * toScripts (Required): [ + * (Required){ + * code: String (Required) + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * } + * ] + * } + * ] + * } + * } + * dictionary (Optional): { + * String (Required): { + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * translations (Required): [ + * (Required){ + * name: String (Required) + * nativeName: String (Required) + * dir: String(ltr/rtl) (Required) + * code: String (Required) + * } + * ] + * } + * } + * } + * } + *+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the set of languages currently supported by other operations of the Translator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response
Header Parameters
+ *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the + * request. |
Request Body Schema
@@ -119,6 +160,31 @@ public final class TextTranslationClient { * [ * (Required){ * text: String (Required) + * script: String (Optional) + * language: String (Optional) + * textType: String(Plain/Html) (Optional) + * targets (Required): [ + * (Required){ + * language (Required): [ + * String (Required) + * ] + * script: String (Optional) + * profanityAction: String(NoAction/Marked/Deleted) (Optional) + * profanityMarker: String(Asterisk/Tag) (Optional) + * deploymentNameModel: String (Optional) + * allowFallback: Boolean (Optional) + * grade: String (Optional) + * tone: String (Optional) + * gender: String (Optional) + * adaptiveDatasetId: String (Optional) + * referenceTextPairs (Optional): [ + * (Optional){ + * referenceTextPairsSource: String (Required) + * referenceTextPairsTarget: String (Required) + * } + * ] + * } + * ] * } * ] * } @@ -142,17 +208,6 @@ public final class TextTranslationClient { * text: String (Required) * script: String (Required) * } - * alignment (Optional): { - * proj: String (Required) - * } - * sentLen (Optional): { - * srcSentLen (Required): [ - * int (Required) - * ] - * transSentLen (Required): [ - * int (Required) - * ] - * } * } * ] * sourceText (Optional): { @@ -162,12 +217,7 @@ public final class TextTranslationClient { * ] * } * - * - * @param targetLanguages Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. + * * @param body Defines the content of the request. * @param requestOptions The options to configure the HTTP request before HTTP client sends it. * @throws HttpResponseException thrown if the request is rejected by server. @@ -178,9 +228,8 @@ public final class TextTranslationClient { */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseQuery Parameters
- *Name | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. |
script | String | No | Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
+ * Gets the set of languages currently supported by other operations of the Translator. * - *- * {@code - * [ - * (Required){ - * detectedLanguage (Optional): { - * language: String (Required) - * score: double (Required) - * } - * sentLen (Required): [ - * int (Required) - * ] - * } - * ] - * } - *- * - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param clientTraceId A client-generated GUID to uniquely identify the request. + * @param scope A comma-separated list of names defining the group of languages to return. + * Allowed group names are: `translation`, `transliteration` and `dictionary`. + * If no scope is given, then all groups are returned, which is equivalent to passing + * `scope=translation,transliteration,dictionary`. To decide which set of supported languages + * is appropriate for your scenario, see the description of the [response object](#response-body). + * @param acceptLanguage The language to use for user interface strings. Some of the fields in the response are + * names of languages or + * names of regions. Use this parameter to define the language in which these names are returned. + * The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` + * to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. + * Names are provided in the English language when a target language is not specified or when localization + * is not available. + * @param ifNoneMatch Passing the value of the ETag response header in an If-None-Match field will allow the service + * to optimize the response. + * If the resource has not been modified, the service will return status code 304 and an empty response body. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of languages currently supported by other operations of the Translator. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *+ * Gets the set of languages currently supported by other operations of the Translator. * - *
Response Body Schema
+ * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of languages currently supported by other operations of the Translator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetSupportedLanguagesResult getSupportedLanguages() { + // Generated convenience method for getSupportedLanguagesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getSupportedLanguagesWithResponse(requestOptions).getValue().toObject(GetSupportedLanguagesResult.class); + } + + /** + * Translate Text. * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * displaySource: String (Required) - * translations (Required): [ - * (Required){ - * normalizedTarget: String (Required) - * displayTarget: String (Required) - * posTag: String (Required) - * confidence: double (Required) - * prefixWord: String (Required) - * backTranslations (Required): [ - * (Required){ - * normalizedText: String (Required) - * displayText: String (Required) - * numExamples: int (Required) - * frequencyCount: int (Required) - * } - * ] - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param clientTraceId A client-generated GUID to uniquely identify the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public Response
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * translation: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * normalizedTarget: String (Required) - * examples (Required): [ - * (Required){ - * sourcePrefix: String (Required) - * sourceTerm: String (Required) - * sourceSuffix: String (Required) - * targetPrefix: String (Required) - * targetTerm: String (Required) - * targetSuffix: String (Required) - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response
- * This method is used when you have single target language and multiple texts to translate. - *
- * - * @param targetLanguage Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you have single target language and single text to translate. - *
- * - * @param targetLanguage Specifies the language of the output text. The target language must be one of the - * supported languages included - * in the translation scope. For example, use to=de to translate to German. - * It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. - * For example, use to=de&to=it to translate to German and Italian. - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TranslatedTextItem translate(String targetLanguage, String text) { - return translate(targetLanguage, Arrays.asList(text)).get(0); - } - - /** - * Translate Text. - *- * This method is used when you have one input text and the optional parameters are needed such as specification - * of a source language, profanity handling etc. - *
- * - * @param text Text to translate. - * @param translateOptions Translate Options. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TranslatedTextItem translate(String text, TranslateOptions translateOptions) { - return translate(Arrays.asList(text), translateOptions).get(0); - } - - /** - * Translate Text. - *- * This method is used when you have multiple texts and the optional parameters are needed such as specification - * of a source language, profanity handling etc.. - *
- * - * @param texts List of text to translate. - * @param translateOptions Translate Options. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you have multiple texts to transliterate and you want to provide client trace id. - *
- * - * @param language Specifies the language of the text to convert from one script to another. - * Possible languages are listed in the transliteration scope obtained by querying the service - * for its supported languages. - * @param sourceLanguageScript Specifies the script used by the input text. Look up supported languages using the - * transliteration scope, - * to find input scripts available for the selected language. - * @param targetLanguageScript Specifies the output script. Look up supported languages using the transliteration - * scope, to find output - * scripts available for the selected combination of input language and input script. - * @param body Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you have single text to transliterate and you want to provide client trace id. - *
- * + * * @param language Specifies the language of the text to convert from one script to another. * Possible languages are listed in the transliteration scope obtained by querying the service * for its supported languages. @@ -749,246 +451,6 @@ public List- * This method is used when you have multiple texts for which you want to find sentence boundaries and you want to - * provide - * client trace id. - *
- * - * @param texts Defines the content of the request. - * @param language Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. - * @param script Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you have single text for which you want to find sentence boundaries and you want to - * provide - * client trace id. - *
- * - * @param text Defines the content of the request. - * @param language Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. - * @param script Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public BreakSentenceItem findSentenceBoundaries(String text, String language, String script) { - return findSentenceBoundaries(Arrays.asList(text), language, script).get(0); - } - - /** - * Find Sentence Boundaries. - * - * @param body Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - private List- * This method is used when you have multiple texts for which you want to find sentence boundaries and you want - * the source language to be auto-detected by the service. - *
- * - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you have single text for which you want to find sentence boundaries and you want - * the source language to be auto-detected by the service. - *
- * - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public BreakSentenceItem findSentenceBoundaries(String text) { - return findSentenceBoundaries(Arrays.asList(text)).get(0); - } - - /** - * Lookup Dictionary Entries. - * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - private List- * This method is used when you want lookup multiple entries in the dictionary and you want to provide - * client trace id. - *
- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param texts Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public List- * This method is used when you want lookup single entry in the dictionary and you want to provide - * client trace id. - *
- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param text Defines the content of the request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DictionaryLookupItem lookupDictionaryEntries(String sourceLanguage, String targetLanguage, String text) { - return lookupDictionaryEntries(sourceLanguage, targetLanguage, Arrays.asList(text)).get(0); - } - - /** - * Lookup Dictionary Examples. - * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. * @param body Defines the content of the request. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1000,12 +462,12 @@ public DictionaryLookupItem lookupDictionaryEntries(String sourceLanguage, Strin */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) - public ListQuery Parameters
- *Name | Type | Required | Description |
---|---|---|---|
scope | String | No | A comma-separated list of names defining the group of languages - * to return. - * Allowed group names are: `translation`, `transliteration` and `dictionary`. - * If no scope is given, then all groups are returned, which is equivalent to passing - * `scope=translation,transliteration,dictionary`. To decide which set of supported languages - * is appropriate for your scenario, see the description of the [response object](#response-body). |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Accept-Language | String | No | The language to use for user interface strings. Some of - * the fields in the response are names of languages or - * names of regions. Use this parameter to define the language in which these names are returned. - * The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` - * to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. - * Names are provided in the English language when a target language is not specified or when localization - * is not available. |
If-None-Match | String | No | Passing the value of the ETag response header in an - * If-None-Match field will allow the service to optimize the response. - * If the resource has not been modified, the service will return status code 304 and an empty response - * body. |
Response Body Schema
- * - *- * {@code - * { - * translation (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * } - * } - * transliteration (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * scripts (Required): [ - * (Required){ - * code: String (Required) - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * toScripts (Required): [ - * (Required){ - * code: String (Required) - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * } - * ] - * } - * ] - * } - * } - * dictionary (Optional): { - * String (Required): { - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * translations (Required): [ - * (Required){ - * name: String (Required) - * nativeName: String (Required) - * dir: String(ltr/rtl) (Required) - * code: String (Required) - * } - * ] - * } - * } - * } - * } - *- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the set of languages currently supported by other operations of the Translator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response
Query Parameters
- *Name | Type | Required | Description |
---|---|---|---|
from | String | No | Specifies the language of the input text. Find which languages are - * available to translate from by - * looking up supported languages using the translation scope. If the from parameter isn't specified, - * automatic language detection is applied to determine the source language. - * - * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. - * Note: the dynamic dictionary feature is case-sensitive. |
textType | String | No | Defines whether the text being translated is plain text or - * HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". |
category | String | No | A string specifying the category (domain) of the translation. - * This parameter is used to get translations - * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator - * project details to this parameter to use your deployed customized system. Default value is: general. |
profanityAction | String | No | Specifies how profanities should be treated in - * translations. - * Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction", "Marked", - * "Deleted". |
profanityMarker | String | No | Specifies how profanities should be marked in - * translations. - * Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk", "Tag". |
includeAlignment | Boolean | No | Specifies whether to include alignment projection - * from source text to translated text. - * Possible values are: true or false (default). |
includeSentenceLength | Boolean | No | Specifies whether to include sentence boundaries - * for the input text and the translated text. - * Possible values are: true or false (default). |
suggestedFrom | String | No | Specifies a fallback language if the language of the - * input text can't be identified. - * Language autodetection is applied when the from parameter is omitted. If detection fails, - * the suggestedFrom language will be assumed. |
fromScript | String | No | Specifies the script of the input text. |
toScript | String | No | Specifies the script of the translated text. |
allowFallback | Boolean | No | Specifies that the service is allowed to fall back to a - * general system when a custom system doesn't exist. - * Possible values are: true (default) or false. - * - * allowFallback=false specifies that the translation should only use systems trained for the category specified - * by the request. If a translation for language X to language Y requires chaining through a pivot language E, - * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. - * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true - * specifies that the service is allowed to fall back to a general system when a custom system doesn't - * exist. |
Header Parameters
*Name | Type | Required | Description |
---|---|---|---|
from | String | No | Specifies the language of the input text. Find which languages are - * available to translate from by - * looking up supported languages using the translation scope. If the from parameter isn't specified, - * automatic language detection is applied to determine the source language. - * - * You must use the from parameter rather than autodetection when using the dynamic dictionary feature. - * Note: the dynamic dictionary feature is case-sensitive. |
textType | String | No | Defines whether the text being translated is plain text or - * HTML text. Any HTML needs to be a well-formed, - * complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html". |
category | String | No | A string specifying the category (domain) of the translation. - * This parameter is used to get translations - * from a customized system built with Custom Translator. Add the Category ID from your Custom Translator - * project details to this parameter to use your deployed customized system. Default value is: general. |
profanityAction | String | No | Specifies how profanities should be treated in - * translations. - * Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction", "Marked", - * "Deleted". |
profanityMarker | String | No | Specifies how profanities should be marked in - * translations. - * Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk", "Tag". |
includeAlignment | Boolean | No | Specifies whether to include alignment projection - * from source text to translated text. - * Possible values are: true or false (default). |
includeSentenceLength | Boolean | No | Specifies whether to include sentence boundaries - * for the input text and the translated text. - * Possible values are: true or false (default). |
suggestedFrom | String | No | Specifies a fallback language if the language of the - * input text can't be identified. - * Language autodetection is applied when the from parameter is omitted. If detection fails, - * the suggestedFrom language will be assumed. |
fromScript | String | No | Specifies the script of the input text. |
toScript | String | No | Specifies the script of the translated text. |
allowFallback | Boolean | No | Specifies that the service is allowed to fall back to a - * general system when a custom system doesn't exist. - * Possible values are: true (default) or false. - * - * allowFallback=false specifies that the translation should only use systems trained for the category specified - * by the request. If a translation for language X to language Y requires chaining through a pivot language E, - * then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. - * If no system is found with the specific category, the request will return a 400 status code. allowFallback=true - * specifies that the service is allowed to fall back to a general system when a custom system doesn't - * exist. |
Header Parameters
*Name | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. |
script | String | No | Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * detectedLanguage (Optional): { - * language: String (Required) - * score: double (Required) - * } - * sentLen (Required): [ - * int (Required) - * ] - * } - * ] - * } - *- * - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Query Parameters
- *Name | Type | Required | Description |
---|---|---|---|
language | String | No | Language tag identifying the language of the input text. - * If a code isn't specified, automatic language detection will be applied. |
script | String | No | Script tag identifying the script used by the input text. - * If a script isn't specified, the default script of the language will be assumed. |
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * detectedLanguage (Optional): { - * language: String (Required) - * score: double (Required) - * } - * sentLen (Required): [ - * int (Required) - * ] - * } - * ] - * } - *- * - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * displaySource: String (Required) - * translations (Required): [ - * (Required){ - * normalizedTarget: String (Required) - * displayTarget: String (Required) - * posTag: String (Required) - * confidence: double (Required) - * prefixWord: String (Required) - * backTranslations (Required): [ - * (Required){ - * normalizedText: String (Required) - * displayText: String (Required) - * numExamples: int (Required) - * frequencyCount: int (Required) - * } - * ] - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * displaySource: String (Required) - * translations (Required): [ - * (Required){ - * normalizedTarget: String (Required) - * displayTarget: String (Required) - * posTag: String (Required) - * confidence: double (Required) - * prefixWord: String (Required) - * backTranslations (Required): [ - * (Required){ - * normalizedText: String (Required) - * displayText: String (Required) - * numExamples: int (Required) - * frequencyCount: int (Required) - * } - * ] - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * translation: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * normalizedTarget: String (Required) - * examples (Required): [ - * (Required){ - * sourcePrefix: String (Required) - * sourceTerm: String (Required) - * sourceSuffix: String (Required) - * targetPrefix: String (Required) - * targetTerm: String (Required) - * targetSuffix: String (Required) - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono
Header Parameters
- *Name | Type | Required | Description |
---|---|---|---|
X-ClientTraceId | String | No | A client-generated GUID to uniquely identify the - * request. |
Request Body Schema
- * - *- * {@code - * [ - * (Required){ - * text: String (Required) - * translation: String (Required) - * } - * ] - * } - *- * - *
Response Body Schema
- * - *- * {@code - * [ - * (Required){ - * normalizedSource: String (Required) - * normalizedTarget: String (Required) - * examples (Required): [ - * (Required){ - * sourcePrefix: String (Required) - * sourceTerm: String (Required) - * sourceSuffix: String (Required) - * targetPrefix: String (Required) - * targetTerm: String (Required) - * targetSuffix: String (Required) - * } - * ] - * } - * ] - * } - *- * - * @param sourceLanguage Specifies the language of the input text. - * The source language must be one of the supported languages included in the dictionary scope. - * @param targetLanguage Specifies the language of the output text. - * The target language must be one of the supported languages included in the dictionary scope. - * @param body Defines the content of the request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response