From 9f3ae9dd908ad3bce8cf00b4a51cfefb07b95e83 Mon Sep 17 00:00:00 2001 From: Michal Materna Date: Mon, 3 Apr 2023 14:09:59 -0700 Subject: [PATCH] Adding Definition for Microsoft Translation service (#23231) * Adding translator API definition (#1) * Adding translator API definition * Fixing PR comments, part 1 * Fixes and python * Add versions * fix PR comments * fix operation definition * Enable all operations and dotnet * Fixes for languages API * Double clients and new auth method * PR comment fix * Switch to custom operations * Removing the APIM client * Adding emitters * Update api-version * Updates to models * Attempt to fix the api-version * Fixing API version * Fix dictionaries. * Fix the models * Models fixes * Removing detect, fix breaksentence * Adding examples * Fixing languages endpoint * Updating generation --------- Co-authored-by: Michal Materna Co-authored-by: Catalina Peralta * Fix the packages names * Update model names * Move files * Switch to knowValues * Reuse transliteration text models * Migrate to TSP * Updating TS files to satisfy pipeline * Adding autorest * Adding swagger file * Adding examples * Fixing path to examples * Speel check fix * Updating name of TS exporter * Updating openapi.json * Linting, spell check fixes * Fix spelling * Test removing generators * Fixing BS example * Fixing model generation * Update examples * Prettier * Generate new openapi.json * adding azure-resource-provider-folder config * Suppress warning * Remove sdk-for-net-track2 * Changing the name of the folder as per PR comment --------- Co-authored-by: Michal Materna Co-authored-by: Catalina Peralta --- cSpell.json | 10 + ...FindSentenceBoundaries_MaximumSet_Gen.json | 28 + ...FindSentenceBoundaries_MinimumSet_Gen.json | 29 + .../3.0/GetLanguages_MaximumSet_Gen.json | 80 + .../3.0/GetLanguages_MinimumSet_Gen.json | 12 + ...ookupDictionaryEntries_MaximumSet_Gen.json | 87 + ...ookupDictionaryEntries_MinimumSet_Gen.json | 86 + ...okupDictionaryExamples_MaximumSet_Gen.json | 44 + ...okupDictionaryExamples_MinimumSet_Gen.json | 43 + .../3.0/Translate_MaximumSet_Gen.json | 63 + .../3.0/Translate_MinimumSet_Gen.json | 29 + .../3.0/Transliterate_MaximumSet_Gen.json | 26 + .../3.0/Transliterate_MinimumSet_Gen.json | 25 + .../Azure.AI.TextTranslation/main.tsp | 50 + .../models-breaksentence.tsp | 50 + .../models-dictionary.tsp | 224 +++ .../models-languages.tsp | 139 ++ .../models-shared.tsp | 48 + .../models-translate.tsp | 258 +++ .../models-transliterate.tsp | 54 + .../Azure.AI.TextTranslation/package.json | 18 + .../Azure.AI.TextTranslation/routes.tsp | 112 ++ .../Azure.AI.TextTranslation/tspconfig.yaml | 23 + .../Azure.AI.TextTranslation/readme.md | 54 + ...FindSentenceBoundaries_MinimumSet_Gen.json | 29 + .../examples/GetLanguages_MinimumSet_Gen.json | 12 + ...ookupDictionaryEntries_MinimumSet_Gen.json | 86 + ...okupDictionaryExamples_MinimumSet_Gen.json | 43 + .../examples/Translate_MinimumSet_Gen.json | 29 + .../Transliterate_MinimumSet_Gen.json | 25 + .../stable/v3.0/openapi.json | 1678 +++++++++++++++++ 31 files changed, 3494 insertions(+) create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MaximumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MinimumSet_Gen.json create mode 100644 specification/translation/Azure.AI.TextTranslation/main.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-breaksentence.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-dictionary.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-languages.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-shared.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-translate.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/models-transliterate.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/package.json create mode 100644 specification/translation/Azure.AI.TextTranslation/routes.tsp create mode 100644 specification/translation/Azure.AI.TextTranslation/tspconfig.yaml create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/readme.md create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/FindSentenceBoundaries_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/GetLanguages_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryEntries_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryExamples_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Translate_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Transliterate_MinimumSet_Gen.json create mode 100644 specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/openapi.json diff --git a/cSpell.json b/cSpell.json index ce410562d110..4739fdb3b71e 100644 --- a/cSpell.json +++ b/cSpell.json @@ -907,6 +907,16 @@ "workflowruns", "workflowtasks" ] + }, + { + "filename": "**/specification/translation/data-plane/**/*.json", + "words": [ + "autodetection", + "breaksentence", + "mosca", + "Transliterable", + "translitered" + ] } ], "enableFiletypes": [ diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MaximumSet_Gen.json new file mode 100644 index 000000000000..728c89f0d828 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MaximumSet_Gen.json @@ -0,0 +1,28 @@ +{ + "title": "Find Sentence Boundaries", + "operationId": "FindSentenceBoundaries", + "parameters": { + "X-ClientTraceId": "svun", + "language": "en", + "script": "Latn", + "api-version": "3.0", + "requestBody": [ + { + "text": "How are you? I am fine. What did you do today?" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "sentLen": [ + 13, + 11, + 22 + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MinimumSet_Gen.json new file mode 100644 index 000000000000..06dde6ef2448 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/FindSentenceBoundaries_MinimumSet_Gen.json @@ -0,0 +1,29 @@ +{ + "title": "Find Sentence Boundaries", + "operationId": "FindSentenceBoundaries", + "parameters": { + "api-version": "3.0", + "requestBody": [ + { + "text": "How are you? I am fine. What did you do today?" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "detectedLanguage": { + "language": "en", + "score": 1.0 + }, + "sentLen": [ + 13, + 11, + 22 + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MaximumSet_Gen.json new file mode 100644 index 000000000000..901ca0112979 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MaximumSet_Gen.json @@ -0,0 +1,80 @@ +{ + "title": "Gets the set of languages currently supported by other operations of the Translator.", + "operationId": "GetLanguages", + "parameters": { + "X-ClientTraceId": "kayfnugjec", + "scope": "translation,transliteration,dictionary", + "Accept-Language": "en", + "If-None-Match": "fpnhruttllvc", + "api-version": "3.0" + }, + "responses": { + "200": { + "body": { + "translation": { + "en": { + "name": "English", + "nativeName": "English", + "dir": "ltr" + }, + "es": { + "name": "Spanish", + "nativeName": "Español", + "dir": "ltr" + } + }, + "transliteration": { + "ar": { + "name": "Arabic", + "nativeName": "العربية", + "scripts": [ + { + "code": "Arab", + "name": "Arabic", + "nativeName": "العربية", + "dir": "rtl", + "toScripts": [ + { + "code": "Latn", + "name": "Latin", + "nativeName": "اللاتينية", + "dir": "ltr" + } + ] + }, + { + "code": "Latn", + "name": "Latin", + "nativeName": "اللاتينية", + "dir": "ltr", + "toScripts": [ + { + "code": "Arab", + "name": "Arabic", + "nativeName": "العربية", + "dir": "rtl" + } + ] + } + ] + } + }, + "dictionary": { + "cs": { + "name": "Czech", + "nativeName": "Čeština", + "dir": "ltr", + "translations": [ + { + "name": "English", + "nativeName": "English", + "dir": "ltr", + "code": "en" + } + ] + } + } + } + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MinimumSet_Gen.json new file mode 100644 index 000000000000..76853b88e225 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/GetLanguages_MinimumSet_Gen.json @@ -0,0 +1,12 @@ +{ + "title": "Gets the set of languages currently supported by other operations of the Translator.", + "operationId": "GetLanguages", + "parameters": { + "api-version": "3.0" + }, + "responses": { + "200": { + "body": {} + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MaximumSet_Gen.json new file mode 100644 index 000000000000..1da1ee01cd31 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MaximumSet_Gen.json @@ -0,0 +1,87 @@ +{ + "title": "Lookup Dictionary Entries", + "operationId": "LookupDictionaryEntries", + "parameters": { + "X-ClientTraceId": "yqst", + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "displaySource": "fly", + "translations": [ + { + "normalizedTarget": "volar", + "displayTarget": "volar", + "posTag": "VERB", + "confidence": 0.4081, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 4637 + }, + { + "normalizedText": "flying", + "displayText": "flying", + "numExamples": 15, + "frequencyCount": 1365 + }, + { + "normalizedText": "blow", + "displayText": "blow", + "numExamples": 15, + "frequencyCount": 503 + }, + { + "normalizedText": "flight", + "displayText": "flight", + "numExamples": 15, + "frequencyCount": 135 + } + ] + }, + { + "normalizedTarget": "mosca", + "displayTarget": "mosca", + "posTag": "NOUN", + "confidence": 0.2668, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 1697 + }, + { + "normalizedText": "flyweight", + "displayText": "flyweight", + "numExamples": 0, + "frequencyCount": 48 + }, + { + "normalizedText": "flies", + "displayText": "flies", + "numExamples": 9, + "frequencyCount": 34 + } + ] + } + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MinimumSet_Gen.json new file mode 100644 index 000000000000..1c6b54e7e4eb --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryEntries_MinimumSet_Gen.json @@ -0,0 +1,86 @@ +{ + "title": "Lookup Dictionary Entries", + "operationId": "LookupDictionaryEntries", + "parameters": { + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "displaySource": "fly", + "translations": [ + { + "normalizedTarget": "volar", + "displayTarget": "volar", + "posTag": "VERB", + "confidence": 0.4081, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 4637 + }, + { + "normalizedText": "flying", + "displayText": "flying", + "numExamples": 15, + "frequencyCount": 1365 + }, + { + "normalizedText": "blow", + "displayText": "blow", + "numExamples": 15, + "frequencyCount": 503 + }, + { + "normalizedText": "flight", + "displayText": "flight", + "numExamples": 15, + "frequencyCount": 135 + } + ] + }, + { + "normalizedTarget": "mosca", + "displayTarget": "mosca", + "posTag": "NOUN", + "confidence": 0.2668, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 1697 + }, + { + "normalizedText": "flyweight", + "displayText": "flyweight", + "numExamples": 0, + "frequencyCount": 48 + }, + { + "normalizedText": "flies", + "displayText": "flies", + "numExamples": 9, + "frequencyCount": 34 + } + ] + } + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MaximumSet_Gen.json new file mode 100644 index 000000000000..328ba8cbe79e --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MaximumSet_Gen.json @@ -0,0 +1,44 @@ +{ + "title": "Lookup Dictionary Examples", + "operationId": "LookupDictionaryExamples", + "parameters": { + "X-ClientTraceId": "vykwwekvcncclrmsyjhbok", + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly", + "translation": "volar" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "normalizedTarget": "volar", + "examples": [ + { + "sourcePrefix": "They need machines to ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Necesitan máquinas para ", + "targetTerm": "volar", + "targetSuffix": "." + }, + { + "sourcePrefix": "That should really ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Eso realmente debe ", + "targetTerm": "volar", + "targetSuffix": "." + } + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MinimumSet_Gen.json new file mode 100644 index 000000000000..267599402c12 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/LookupDictionaryExamples_MinimumSet_Gen.json @@ -0,0 +1,43 @@ +{ + "title": "Lookup Dictionary Examples", + "operationId": "LookupDictionaryExamples", + "parameters": { + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly", + "translation": "volar" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "normalizedTarget": "volar", + "examples": [ + { + "sourcePrefix": "They need machines to ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Necesitan máquinas para ", + "targetTerm": "volar", + "targetSuffix": "." + }, + { + "sourcePrefix": "That should really ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Eso realmente debe ", + "targetTerm": "volar", + "targetSuffix": "." + } + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MaximumSet_Gen.json new file mode 100644 index 000000000000..88c313fa9ec8 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MaximumSet_Gen.json @@ -0,0 +1,63 @@ +{ + "title": "Translate Text", + "operationId": "Translate", + "parameters": { + "X-ClientTraceId": "ndbkaatzsnoetqkiehappoza", + "to": [ + "cs" + ], + "from": "en", + "textType": "plain", + "category": "custom", + "profanityAction": "NoAction", + "profanityMarker": "Asterisk", + "includeAlignment": true, + "includeSentenceLength": true, + "suggestedFrom": "en", + "fromScript": "Latn", + "toScript": "Latn", + "allowFallback": true, + "api-version": "3.0", + "requestBody": [ + { + "text": "This is a test." + } + ] + }, + "responses": { + "200": { + "body": [ + { + "detectedLanguage": { + "language": "en", + "score": 1.0 + }, + "translations": [ + { + "to": "cs", + "text": "Tohle je test.", + "transliteration": { + "text": "Tohle je test.", + "script": "Latn" + }, + "alignment": { + "proj": "okrxvzsagjgzrrv" + }, + "sentLen": { + "srcSentLen": [ + 30 + ], + "transSentLen": [ + 24 + ] + } + } + ], + "sourceText": { + "text": "This is a test" + } + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MinimumSet_Gen.json new file mode 100644 index 000000000000..f5f0658336b7 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Translate_MinimumSet_Gen.json @@ -0,0 +1,29 @@ +{ + "title": "Translate Text", + "operationId": "Translate", + "parameters": { + "to": [ + "fmlxpuepn" + ], + "api-version": "3.0", + "requestBody": [ + { + "text": "This is a test." + } + ] + }, + "responses": { + "200": { + "body": [ + { + "translations": [ + { + "text": "Tohle je test.", + "to": "cs" + } + ] + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MaximumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MaximumSet_Gen.json new file mode 100644 index 000000000000..98b0d124990f --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MaximumSet_Gen.json @@ -0,0 +1,26 @@ +{ + "title": "Transliterate Text", + "operationId": "Transliterate", + "parameters": { + "X-ClientTraceId": "dzncrimwmvtwjnheh", + "language": "zh-Hans", + "fromScript": "Hans", + "toScript": "Latn", + "api-version": "3.0", + "requestBody": [ + { + "text": "这是个测试。" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "text": "zhè shì gè cè shì。", + "script": "Latn" + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MinimumSet_Gen.json b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MinimumSet_Gen.json new file mode 100644 index 000000000000..ead6cff591f0 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/examples/3.0/Transliterate_MinimumSet_Gen.json @@ -0,0 +1,25 @@ +{ + "title": "Transliterate Text", + "operationId": "Transliterate", + "parameters": { + "language": "zh-Hans", + "fromScript": "Hans", + "toScript": "Latn", + "api-version": "3.0", + "requestBody": [ + { + "text": "这是个测试。" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "text": "zhè shì gè cè shì。", + "script": "Latn" + } + ] + } + } +} diff --git a/specification/translation/Azure.AI.TextTranslation/main.tsp b/specification/translation/Azure.AI.TextTranslation/main.tsp new file mode 100644 index 000000000000..5fe00b53c8b5 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/main.tsp @@ -0,0 +1,50 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "./routes.tsp"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using Azure.Core; +using TypeSpec.Versioning; + +@service({ + title: "Text Translation", +}) +@server( + "{Endpoint}", + "Text translation is a cloud-based REST API feature of the Translator service that uses neural machine translation technology to enable quick and accurate source-to-target text translation in real time across all supported languages.", + { + @doc(""" +Supported Text Translation endpoints (protocol and hostname, for example: + https://api.cognitive.microsofttranslator.com). +""") + Endpoint: url, + } +) +@doc(""" +Text translation is a cloud-based REST API feature of the Translator service that uses neural +machine translation technology to enable quick and accurate source-to-target text translation +in real time across all supported languages. + +The following methods are supported by the Text Translation feature: + +Languages. Returns a list of languages supported by Translate, Transliterate, and Dictionary Lookup operations. + +Translate. Renders single source-language text to multiple target-language texts with a single request. + +Transliterate. Converts characters or letters of a source language to the corresponding characters or letters of a target language. + +Detect. Returns the source code language code and a boolean variable denoting whether the detected language is supported for text translation and transliteration. + +Dictionary lookup. Returns equivalent words for the source term in the target language. + +Dictionary example Returns grammatical structure and context examples for the source term and target term pair. +""") +@versioned(APIVersion) +namespace TextTranslation; + +@doc("Text Translation supported versions") +enum APIVersion { + v3_0: "3.0", +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-breaksentence.tsp b/specification/translation/Azure.AI.TextTranslation/models-breaksentence.tsp new file mode 100644 index 000000000000..5f610cce63b6 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-breaksentence.tsp @@ -0,0 +1,50 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-shared.tsp"; +import "./models-translate.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +@doc("Request parameters for the break sentence API.") +model BreakSentenceParameters { + ...CommonParameters; + + @query + @doc(""" + Language tag identifying the language of the input text. + If a code isn't specified, automatic language detection will be applied. + """) + language?: string; + + @query + @doc(""" + 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. + """) + script?: string; +} + +@doc("Response for the Break SEntence API.") +model BreakSentenceResult { + ...CommonResultHeaders; + + @body + @doc("Array of the break sentence elements.") + result: BreakSentenceItem[]; +} + +@doc("Item containing break sentence result.") +model BreakSentenceItem { + @doc("The detectedLanguage property is only present in the result object when language auto-detection is requested.") + detectedLanguage?: DetectedLanguage; + + @doc(""" + An integer array representing the lengths of the sentences in the input text. + The length of the array is the number of sentences, and the values are the length of each sentence. + """) + sentLen: int32[]; +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-dictionary.tsp b/specification/translation/Azure.AI.TextTranslation/models-dictionary.tsp new file mode 100644 index 000000000000..b3af9ed3b942 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-dictionary.tsp @@ -0,0 +1,224 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-shared.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +alias DictionaryBaseParameters = { + ...CommonParameters; + + @query + @doc(""" + Specifies the language of the input text. + The source language must be one of the supported languages included in the dictionary scope. + """) + from: string; + + @query + @doc(""" + Specifies the language of the output text. + The target language must be one of the supported languages included in the dictionary scope. + """) + to: string; +}; + +@doc("Request parameters for the dictionary lookup API.") +model DictionaryLookupParameters { + ...DictionaryBaseParameters; +} + +@doc("Request parameters for the dictionary examples API.") +model DictionaryExamplesParameters { + ...DictionaryBaseParameters; +} + +@doc("Response for the dictionary lookup API.") +model DictionaryLookupResult { + ...CommonResultHeaders; + + @body + @doc("Array of the dictionary lookup elements.") + result: DictionaryLookupItem[]; +} + +@doc("Response for the dictionary examples API.") +model DictionaryExamplesResult { + ...CommonResultHeaders; + + @body + @doc("Array of the dictionary examples elements.") + result: DictionaryExampleItem[]; +} + +@doc("Element containing the text with translation.") +model DictionaryExampleTextItem extends InputTextItem { + @doc(""" + A string specifying the translated text previously returned by the Dictionary lookup operation. + This should be the value from the normalizedTarget field in the translations list of the Dictionary + lookup response. The service will return examples for the specific source-target word-pair. + """) + translation: string; +} + +@doc("Dictionary Lookup Element") +model DictionaryLookupItem { + @doc(""" + A string giving the normalized form of the source term. + For example, if the request is "JOHN", the normalized form will be "john". + The content of this field becomes the input to lookup examples. + """) + normalizedSource: string; + + @doc(""" + A string giving the source term in a form best suited for end-user display. + For example, if the input is "JOHN", the display form will reflect the usual + spelling of the name: "John". + """) + displaySource: string; + + @doc(""" + A list of translations for the source term. + """) + translations: DictionaryTranslation[]; +} + +@doc("Translation source term.") +model DictionaryTranslation { + @doc(""" + A string giving the normalized form of this term in the target language. + This value should be used as input to lookup examples. + """) + normalizedTarget: string; + + @doc(""" + A string giving the term in the target language and in a form best suited + for end-user display. Generally, this will only differ from the normalizedTarget + in terms of capitalization. For example, a proper noun like "Juan" will have + normalizedTarget = "juan" and displayTarget = "Juan". + """) + displayTarget: string; + + @doc(""" + A string associating this term with a part-of-speech tag. + """) + posTag: string; + + @doc(""" + A value between 0.0 and 1.0 which represents the "confidence" + (or perhaps more accurately, "probability in the training data") of that translation pair. + The sum of confidence scores for one source word may or may not sum to 1.0. + """) + confidence: float32; + + @doc(""" + A string giving the word to display as a prefix of the translation. Currently, + this is the gendered determiner of nouns, in languages that have gendered determiners. + For example, the prefix of the Spanish word "mosca" is "la", since "mosca" is a feminine noun in Spanish. + This is only dependent on the translation, and not on the source. + If there is no prefix, it will be the empty string. + """) + prefixWord: string; + + @doc(""" + A list of "back translations" of the target. For example, source words that the target can translate to. + The list is guaranteed to contain the source word that was requested (e.g., if the source word being + looked up is "fly", then it is guaranteed that "fly" will be in the backTranslations list). + However, it is not guaranteed to be in the first position, and often will not be. + """) + backTranslations: BackTranslation[]; +} + +@doc("Back Translation") +model BackTranslation { + @doc(""" + A string giving the normalized form of the source term that is a back-translation of the target. + This value should be used as input to lookup examples. + """) + normalizedText: string; + + @doc(""" + A string giving the source term that is a back-translation of the target in a form best + suited for end-user display. + """) + displayText: string; + + @doc(""" + An integer representing the number of examples that are available for this translation pair. + Actual examples must be retrieved with a separate call to lookup examples. The number is mostly + intended to facilitate display in a UX. For example, a user interface may add a hyperlink + to the back-translation if the number of examples is greater than zero and show the back-translation + as plain text if there are no examples. Note that the actual number of examples returned + by a call to lookup examples may be less than numExamples, because additional filtering may be + applied on the fly to remove "bad" examples. + """) + numExamples: int32; + + @doc(""" + An integer representing the frequency of this translation pair in the data. The main purpose of this + field is to provide a user interface with a means to sort back-translations so the most frequent terms are first. + """) + frequencyCount: int32; +} + +@doc("Dictionary Example element") +model DictionaryExampleItem { + @doc(""" + A string giving the normalized form of the source term. Generally, this should be identical + to the value of the Text field at the matching list index in the body of the request. + """) + normalizedSource: string; + + @doc(""" + A string giving the normalized form of the target term. Generally, this should be identical + to the value of the Translation field at the matching list index in the body of the request. + """) + normalizedTarget: string; + + @doc(""" + A list of examples for the (source term, target term) pair. + """) + examples: DictionaryExample[]; +} + +@doc("Dictionary Example") +model DictionaryExample { + @doc(""" + The string to concatenate before the value of sourceTerm to form a complete example. + Do not add a space character, since it is already there when it should be. + This value may be an empty string. + """) + sourcePrefix: string; + + @doc(""" + A string equal to the actual term looked up. The string is added with sourcePrefix + and sourceSuffix to form the complete example. Its value is separated so it can be + marked in a user interface, e.g., by bolding it. + """) + sourceTerm: string; + + @doc(""" + The string to concatenate after the value of sourceTerm to form a complete example. + Do not add a space character, since it is already there when it should be. + This value may be an empty string. + """) + sourceSuffix: string; + + @doc(""" + A string similar to sourcePrefix but for the target. + """) + targetPrefix: string; + + @doc(""" + A string similar to sourceTerm but for the target. + """) + targetTerm: string; + + @doc(""" + A string similar to sourceSuffix but for the target. + """) + targetSuffix: string; +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-languages.tsp b/specification/translation/Azure.AI.TextTranslation/models-languages.tsp new file mode 100644 index 000000000000..ff0f3b01d131 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-languages.tsp @@ -0,0 +1,139 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-shared.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +@doc("Request parameters for the language API.") +model GetLanguageParameters { + ...CommonParameters; + + @query + @doc(""" + 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). + """) + scope?: string; + + @header("Accept-Language") + @doc(""" + 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. + """) + acceptLanguage?: string = "en"; + + @header("If-None-Match") + @doc(""" + 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. + """) + ifNoneMatch?: string; +} + +@doc("Response for the languages API.") +model GetLanguagesResult { + ...CommonResultHeaders; + + @header("ETag") + @doc(""" + Current value of the entity tag for the requested groups of supported languages. + To make subsequent requests more efficient, the client may send the `ETag` value in an + `If-None-Match` header field. + """) + etag: string; + + @doc("Languages that support translate API.") + translation?: Record; + + @doc("Languages that support transliteration API.") + transliteration?: Record; + + @doc("Languages that support dictionary API.") + dictionary?: Record; +} + +alias CommonLanguageModel = { + @doc("Display name of the language in the locale requested via Accept-Language header.") + name: string; + + @doc("Display name of the language in the locale native for this language.") + nativeName: string; +}; + +@doc(""" +The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag. +A key identifies a language for which text can be translated to or translated from. +""") +model TranslationLanguage { + ...CommonLanguageModel; + + @doc("Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages.") + dir: string; +} + +@doc(""" +The value of the transliteration property is a dictionary of (key, value) pairs. +Each key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script +to another script. +""") +model TransliterationLanguage { + ...CommonLanguageModel; + + @doc("List of scripts to convert from.") + scripts: TransliterableScript[]; +} + +@doc("Script definition with list of script into which given script can be translitered.") +model TransliterableScript extends CommonScriptModel { + @doc("List of scripts available to convert text to.") + toScripts: CommonScriptModel[]; +} + +@doc("Common properties of language script") +model CommonScriptModel { + @doc("Code identifying the script.") + code: string; + + @doc("Display name of the script in the locale requested via Accept-Language header.") + name: string; + + @doc("Display name of the language in the locale native for the language.") + nativeName: string; + + @doc("Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages.") + dir: string; +} + +alias CommonDictionaryLanguageModel = { + ...CommonLanguageModel; + + @doc("Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages.") + dir: string; +}; + +@doc("Properties ot the source dictionary language") +model SourceDictionaryLanguage { + ...CommonDictionaryLanguageModel; + + @doc("List of languages with alterative translations and examples for the query expressed in the source language.") + translations: TargetDictionaryLanguage[]; +} + +@doc("Properties of the target dictionary language") +model TargetDictionaryLanguage { + ...CommonDictionaryLanguageModel; + + @doc("Language code identifying the target language.") + code: string; +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-shared.tsp b/specification/translation/Azure.AI.TextTranslation/models-shared.tsp new file mode 100644 index 000000000000..87df889e0c2b --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-shared.tsp @@ -0,0 +1,48 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +alias CommonParameters = { + @header("X-ClientTraceId") + @doc(""" + A client-generated GUID to uniquely identify the request. + """) + clientTraceId?: string; +}; + +@doc("Element containing the text for translation.") +model InputTextItem { + @doc("Text to translate.") + text: string; +} + +alias CommonResultHeaders = { + @header("X-RequestId") + @doc(""" + Value generated by the service to identify the request. It is used for troubleshooting purposes. + """) + requestId: string; +}; + +@doc("Representation of the Error Response from Translator Service.") +@error +model ErrorResponse { + ...CommonResultHeaders; + + @doc("Error details.") + error: ErrorDetails; +} + +@doc("Error details as returned by Translator Service.") +model ErrorDetails { + @doc("Number identifier of the error.") + code: int32; + + @doc("Human readable error description.") + message: string; +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-translate.tsp b/specification/translation/Azure.AI.TextTranslation/models-translate.tsp new file mode 100644 index 000000000000..c81e79bf8298 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-translate.tsp @@ -0,0 +1,258 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-shared.tsp"; +import "./models-transliterate.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +@doc("Request parameters for the translate API.") +model TranslateParameters { + ...CommonParameters; + + @query + @doc(""" + 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. + """) + to: string[]; + + @query + @doc(""" + 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. + """) + from?: string; + + @query + @doc(""" + 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. + """) + textType?: TextType = "Plain"; + + @query + @doc(""" + 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. + """) + category?: string = "general"; + + @query + @doc(""" + Specifies how profanities should be treated in translations. + Possible values are: NoAction (default), Marked or Deleted. + """) + profanityAction?: ProfanityAction = "NoAction"; + + @query + @doc(""" + Specifies how profanities should be marked in translations. + Possible values are: Asterisk (default) or Tag. + """) + profanityMarker?: ProfanityMarker = "Asterisk"; + + @query + @doc(""" + Specifies whether to include alignment projection from source text to translated text. + Possible values are: true or false (default). + """) + includeAlignment?: boolean = false; + + @query + @doc(""" + Specifies whether to include sentence boundaries for the input text and the translated text. + Possible values are: true or false (default). + """) + includeSentenceLength?: boolean = false; + + @query + @doc(""" + 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. + """) + suggestedFrom?: string; + + @query + @doc(""" + Specifies the script of the input text. + """) + fromScript?: string; + + @query + @doc(""" + Specifies the script of the translated text. + """) + toScript?: string; + + @query + @doc(""" + 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. + """) + allowFallback?: boolean = true; +} + +@doc("Response for the translation API.") +model TranslationResult { + ...CommonResultHeaders; + + @body + @doc("Array of the translated text elements.") + result: TranslatedTextItem[]; + + @header("x-mt-system") + @doc(""" + Specifies the system type that was used for translation for each 'to' language requested for translation. + The value is a comma-separated list of strings. Each string indicates a type: + + * Custom - Request includes a custom system and at least one custom system was used during translation. + * Team - All other requests + """) + mtSystem: string; + + @header("x-metered-usage") + @doc(""" + Specifies consumption (the number of characters for which the user will be charged) for the translation + job request. For example, if the word "Hello" is translated from English (en) to French (fr), + this field will return the value '5'. + """) + meteredUsage: int32; +} + +enum TextTypeKnownValues { + Plain: "Plain", + Html: "Html", +} + +@doc("Translation text type") +@knownValues(TextTypeKnownValues) +scalar TextType extends string; + +enum ProfanityActionKnownValues { + NoAction: "NoAction", + Marked: "Marked", + Deleted: "Deleted", +} + +@doc("Translator profanity actions") +@knownValues(ProfanityActionKnownValues) +scalar ProfanityAction extends string; + +enum ProfanityMarkerKnownValues { + Asterisk: "Asterisk", + Tag: "Tag", +} + +@doc("Translator profanity markers") +@knownValues(ProfanityMarkerKnownValues) +scalar ProfanityMarker extends string; + +@doc("Element containing the translated text") +model TranslatedTextItem { + @doc("The detectedLanguage property is only present in the result object when language auto-detection is requested.") + detectedLanguage?: DetectedLanguage; + + @doc(""" + An array of translation results. The size of the array matches the number of target + languages specified through the to query parameter. + """) + translations: Translation[]; + + @doc(""" + Input text in the default script of the source language. sourceText property is present only when + the input is expressed in a script that's not the usual script for the language. For example, + if the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text + converted into Arab script. + """) + sourceText?: SourceText; +} + +@doc("An object describing the detected language.") +model DetectedLanguage { + @doc("A string representing the code of the detected language.") + language: string; + + @doc(""" + A float value indicating the confidence in the result. + The score is between zero and one and a low score indicates a low confidence. + """) + score: float32; +} + +@doc("Translation result") +model Translation { + @doc("A string representing the language code of the target language.") + to: string; + + @doc("A string giving the translated text.") + text: string; + + @doc(""" + An object giving the translated text in the script specified by the toScript parameter. + """) + transliteration?: TransliteratedText; + + @doc(""" + Alignment information. + """) + alignment?: TranslatedTextAlignment; + + @doc(""" + Sentence boundaries in the input and output texts. + """) + sentLen?: SentenceLength; +} + +@doc("Alignment information object.") +model TranslatedTextAlignment { + @doc(""" + Maps input text to translated text. The alignment information is only provided when the request + parameter includeAlignment is true. Alignment is returned as a string value of the following + format: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]]. + The colon separates start and end index, the dash separates the languages, and space separates the words. + One word may align with zero, one, or multiple words in the other language, and the aligned words may + be non-contiguous. When no alignment information is available, the alignment element will be empty. + """) + proj: string; +} + +@doc("An object returning sentence boundaries in the input and output texts.") +model SentenceLength { + @doc(""" + An integer array representing the lengths of the sentences in the input text. + The length of the array is the number of sentences, and the values are the length of each sentence. + """) + srcSentLen: int32[]; + + @doc(""" + An integer array representing the lengths of the sentences in the translated text. + The length of the array is the number of sentences, and the values are the length of each sentence. + """) + transSentLen: int32[]; +} + +@doc("Input text in the default script of the source language. ") +model SourceText { + @doc(""" + Input text in the default script of the source language. + """) + text: string; +} diff --git a/specification/translation/Azure.AI.TextTranslation/models-transliterate.tsp b/specification/translation/Azure.AI.TextTranslation/models-transliterate.tsp new file mode 100644 index 000000000000..9b83982e17fb --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/models-transliterate.tsp @@ -0,0 +1,54 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-shared.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; + +namespace TextTranslation; + +@doc("Request parameters for the transliterate API.") +model TransliterateParameters { + ...CommonParameters; + + @query + @doc(""" + 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. + """) + language: string; + + @query + @doc(""" + 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. + """) + fromScript: string; + + @query + @doc(""" + 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. + """) + toScript: string; +} + +@doc("Response for the transliteration API.") +model TransliterateResult { + ...CommonResultHeaders; + + @body + @doc("Array of transliterated texts") + result: TransliteratedText[]; +} + +@doc("Transliterated text element.") +model TransliteratedText { + @doc("A string which is the result of converting the input string to the output script.") + text: string; + + @doc("A string specifying the script used in the output.") + script: string; +} diff --git a/specification/translation/Azure.AI.TextTranslation/package.json b/specification/translation/Azure.AI.TextTranslation/package.json new file mode 100644 index 000000000000..c9aa63501198 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/package.json @@ -0,0 +1,18 @@ +{ + "name": "@cadl-api-spec/translation-text", + "author": "Microsoft Corporation", + "description": "Text translation is a cloud-based REST API feature of the Translator service that uses neural machine translation technology to enable quick and accurate source-to-target text translation in real time across all supported languages.", + "license": "MIT", + "dependencies": { + "@azure-tools/typespec-apiview": "latest", + "@azure-tools/typespec-autorest": "latest", + "@azure-tools/typespec-azure-core": "latest", + "@azure-tools/typespec-client-generator-core": "latest", + "@typespec/compiler": "latest", + "@typespec/openapi": "latest", + "@typespec/openapi3": "latest", + "@typespec/rest": "latest", + "@typespec/http": "latest" + }, + "private": true +} diff --git a/specification/translation/Azure.AI.TextTranslation/routes.tsp b/specification/translation/Azure.AI.TextTranslation/routes.tsp new file mode 100644 index 000000000000..e1f1655c8fce --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/routes.tsp @@ -0,0 +1,112 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "./models-languages.tsp"; +import "./models-translate.tsp"; +import "./models-transliterate.tsp"; +import "./models-breaksentence.tsp"; +import "./models-dictionary.tsp"; + +using Azure.Core; +using TypeSpec.Rest; +using TypeSpec.Http; + +namespace TextTranslation; + +@doc("Defines Text Translation custom Operation") +op CustomOperation( + ...TParams, + + @doc("Defines the content of the request") + @body + requestBody: TBody, + + @doc("Mandatory API version parameter") + @query("api-version") + apiVersion: string +): TResponse | TError; + +@doc("Defines Text Translation custom Operations which doesn't have any content in the request") +op CustomGetOperation( + ...TParams, + + @doc("Mandatory API version parameter") + @query("api-version") + apiVersion: string +): TResponse | TError; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@get +@route("languages") +@summary("Gets the set of languages currently supported by other operations of the Translator.") +@doc("Gets the set of languages currently supported by other operations of the Translator.") +op GetLanguages is CustomGetOperation< + GetLanguageParameters, + GetLanguagesResult, + {}, + ErrorResponse +>; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@post +@route("translate") +@summary("Translate Text") +@doc("Translate Text") +op Translate is CustomOperation< + InputTextItem[], + TranslateParameters, + TranslationResult, + {}, + ErrorResponse +>; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@post +@route("transliterate") +@summary("Transliterate Text") +@doc("Transliterate Text") +op Transliterate is CustomOperation< + InputTextItem[], + TransliterateParameters, + TransliterateResult, + {}, + ErrorResponse +>; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@post +@route("breaksentence") +@summary("Find Sentence Boundaries") +@doc("Find Sentence Boundaries") +op FindSentenceBoundaries is CustomOperation< + InputTextItem[], + BreakSentenceParameters, + BreakSentenceResult, + {}, + ErrorResponse +>; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@post +@route("dictionary/lookup") +@summary("Lookup Dictionary Entries") +@doc("Lookup Dictionary Entries") +op LookupDictionaryEntries is CustomOperation< + InputTextItem[], + DictionaryLookupParameters, + DictionaryLookupResult, + {}, + ErrorResponse +>; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is an existing service, we have a non-conforming operation." +@post +@route("dictionary/examples") +@summary("Lookup Dictionary Examples") +@doc("Lookup Dictionary Examples") +op LookupDictionaryExamples is CustomOperation< + DictionaryExampleTextItem[], + DictionaryExamplesParameters, + DictionaryExamplesResult, + {}, + ErrorResponse +>; diff --git a/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml b/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml new file mode 100644 index 000000000000..8f95639b2df9 --- /dev/null +++ b/specification/translation/Azure.AI.TextTranslation/tspconfig.yaml @@ -0,0 +1,23 @@ +options: + "@azure-tools/typespec-autorest": + "output-file": "openapi.json" + azure-resource-provider-folder: ../data-plane/Azure.AI.TextTranslation + "examples-directory": ./examples + "@azure-tools/typespec-csharp": + clear-output-folder: true + namespace: Azure.AI.Translation.Text + model-namespace: false + "@azure-tools/typespec-python": + "basic-setup-py": true + "package-version": 1.0.0b1 + "package-name": azure-ai-translation-text + "@azure-tools/typespec-java": + partial-update: true + namespace: com.azure.ai.translation.text + "@azure-tools/typespec-ts": + generateMetadata: true + generateTest: true + azureSdkForJs: true + packageDetails: + name: "@azure-rest/ai-translation-text" + description: "Microsoft Translation Text" diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/readme.md b/specification/translation/data-plane/Azure.AI.TextTranslation/readme.md new file mode 100644 index 000000000000..b55f41720d99 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/readme.md @@ -0,0 +1,54 @@ +# Cognitive Services Translation Text SDK + +> see https://aka.ms/autorest + +Configuration for generating Translation Text SDK. + +The current release is `release_3_0`. + +``` yaml +tag: release_3_0 +add-credentials: true +openapi-type: data-plane +``` + +# Releases + +### Release 3.0 +These settings apply only when `--tag=release_3_0` is specified on the command line. + +``` yaml $(tag) == 'release_3_0' +input-file: stable/v3.0/openapi.json +``` + +## Swagger to SDK + +This section describes what SDK should be generated by the automatic system. +This is not used by Autorest itself. + +``` yaml $(swagger-to-sdk) +swagger-to-sdk: + ``` + +## Multi-API/Profile support for AutoRest v3 generators + +AutoRest V3 generators require the use of `--tag=all-api-versions` to select api files. + +This block is updated by an automatic script. Edits may be lost! + +``` yaml $(tag) == 'all-api-versions' /* autogenerated */ +# include the azure profile definitions from the standard location +require: $(this-folder)/../../../../profiles/readme.md + +# all the input files across all versions +input-file: + - $(this-folder)/stable/v3.0/openapi.json +``` + +If there are files that should not be in the `all-api-versions` set, +uncomment the `exclude-file` section below and add the file paths. + +``` yaml $(tag) == 'all-api-versions' +#exclude-file: +# - $(this-folder)/Microsoft.Example/stable/2010-01-01/somefile.json +``` diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/FindSentenceBoundaries_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/FindSentenceBoundaries_MinimumSet_Gen.json new file mode 100644 index 000000000000..06dde6ef2448 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/FindSentenceBoundaries_MinimumSet_Gen.json @@ -0,0 +1,29 @@ +{ + "title": "Find Sentence Boundaries", + "operationId": "FindSentenceBoundaries", + "parameters": { + "api-version": "3.0", + "requestBody": [ + { + "text": "How are you? I am fine. What did you do today?" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "detectedLanguage": { + "language": "en", + "score": 1.0 + }, + "sentLen": [ + 13, + 11, + 22 + ] + } + ] + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/GetLanguages_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/GetLanguages_MinimumSet_Gen.json new file mode 100644 index 000000000000..76853b88e225 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/GetLanguages_MinimumSet_Gen.json @@ -0,0 +1,12 @@ +{ + "title": "Gets the set of languages currently supported by other operations of the Translator.", + "operationId": "GetLanguages", + "parameters": { + "api-version": "3.0" + }, + "responses": { + "200": { + "body": {} + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryEntries_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryEntries_MinimumSet_Gen.json new file mode 100644 index 000000000000..1c6b54e7e4eb --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryEntries_MinimumSet_Gen.json @@ -0,0 +1,86 @@ +{ + "title": "Lookup Dictionary Entries", + "operationId": "LookupDictionaryEntries", + "parameters": { + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "displaySource": "fly", + "translations": [ + { + "normalizedTarget": "volar", + "displayTarget": "volar", + "posTag": "VERB", + "confidence": 0.4081, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 4637 + }, + { + "normalizedText": "flying", + "displayText": "flying", + "numExamples": 15, + "frequencyCount": 1365 + }, + { + "normalizedText": "blow", + "displayText": "blow", + "numExamples": 15, + "frequencyCount": 503 + }, + { + "normalizedText": "flight", + "displayText": "flight", + "numExamples": 15, + "frequencyCount": 135 + } + ] + }, + { + "normalizedTarget": "mosca", + "displayTarget": "mosca", + "posTag": "NOUN", + "confidence": 0.2668, + "prefixWord": "", + "backTranslations": [ + { + "normalizedText": "fly", + "displayText": "fly", + "numExamples": 15, + "frequencyCount": 1697 + }, + { + "normalizedText": "flyweight", + "displayText": "flyweight", + "numExamples": 0, + "frequencyCount": 48 + }, + { + "normalizedText": "flies", + "displayText": "flies", + "numExamples": 9, + "frequencyCount": 34 + } + ] + } + ] + } + ] + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryExamples_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryExamples_MinimumSet_Gen.json new file mode 100644 index 000000000000..267599402c12 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/LookupDictionaryExamples_MinimumSet_Gen.json @@ -0,0 +1,43 @@ +{ + "title": "Lookup Dictionary Examples", + "operationId": "LookupDictionaryExamples", + "parameters": { + "from": "en", + "to": "es", + "api-version": "3.0", + "requestBody": [ + { + "text": "fly", + "translation": "volar" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "normalizedSource": "fly", + "normalizedTarget": "volar", + "examples": [ + { + "sourcePrefix": "They need machines to ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Necesitan máquinas para ", + "targetTerm": "volar", + "targetSuffix": "." + }, + { + "sourcePrefix": "That should really ", + "sourceTerm": "fly", + "sourceSuffix": ".", + "targetPrefix": "Eso realmente debe ", + "targetTerm": "volar", + "targetSuffix": "." + } + ] + } + ] + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Translate_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Translate_MinimumSet_Gen.json new file mode 100644 index 000000000000..f5f0658336b7 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Translate_MinimumSet_Gen.json @@ -0,0 +1,29 @@ +{ + "title": "Translate Text", + "operationId": "Translate", + "parameters": { + "to": [ + "fmlxpuepn" + ], + "api-version": "3.0", + "requestBody": [ + { + "text": "This is a test." + } + ] + }, + "responses": { + "200": { + "body": [ + { + "translations": [ + { + "text": "Tohle je test.", + "to": "cs" + } + ] + } + ] + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Transliterate_MinimumSet_Gen.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Transliterate_MinimumSet_Gen.json new file mode 100644 index 000000000000..ead6cff591f0 --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/examples/Transliterate_MinimumSet_Gen.json @@ -0,0 +1,25 @@ +{ + "title": "Transliterate Text", + "operationId": "Transliterate", + "parameters": { + "language": "zh-Hans", + "fromScript": "Hans", + "toScript": "Latn", + "api-version": "3.0", + "requestBody": [ + { + "text": "这是个测试。" + } + ] + }, + "responses": { + "200": { + "body": [ + { + "text": "zhè shì gè cè shì。", + "script": "Latn" + } + ] + } + } +} diff --git a/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/openapi.json b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/openapi.json new file mode 100644 index 000000000000..883148aa3f6c --- /dev/null +++ b/specification/translation/data-plane/Azure.AI.TextTranslation/stable/v3.0/openapi.json @@ -0,0 +1,1678 @@ +{ + "swagger": "2.0", + "info": { + "title": "Text Translation", + "version": "3.0", + "description": "Text translation is a cloud-based REST API feature of the Translator service that uses neural\nmachine translation technology to enable quick and accurate source-to-target text translation\nin real time across all supported languages.\n\nThe following methods are supported by the Text Translation feature:\n\nLanguages. Returns a list of languages supported by Translate, Transliterate, and Dictionary Lookup operations.\n\nTranslate. Renders single source-language text to multiple target-language texts with a single request.\n\nTransliterate. Converts characters or letters of a source language to the corresponding characters or letters of a target language.\n\nDetect. Returns the source code language code and a boolean variable denoting whether the detected language is supported for text translation and transliteration.\n\nDictionary lookup. Returns equivalent words for the source term in the target language.\n\nDictionary example Returns grammatical structure and context examples for the source term and target term pair.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "x-ms-parameterized-host": { + "hostTemplate": "{Endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "name": "Endpoint", + "in": "path", + "required": true, + "description": "Supported Text Translation endpoints (protocol and hostname, for example:\n https://api.cognitive.microsofttranslator.com).", + "type": "string", + "format": "uri", + "x-ms-skip-url-encoding": true + } + ] + }, + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "tags": [], + "paths": { + "/breaksentence": { + "post": { + "operationId": "FindSentenceBoundaries", + "summary": "Find Sentence Boundaries", + "description": "Find Sentence Boundaries", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "$ref": "#/parameters/BreakSentenceParameters.language" + }, + { + "$ref": "#/parameters/BreakSentenceParameters.script" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + }, + { + "name": "requestBody", + "in": "body", + "required": true, + "description": "Defines the content of the request", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/InputTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "InputTextItem[]" + } + } + ], + "responses": { + "200": { + "description": "Response for the Break SEntence API.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/BreakSentenceItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "BreakSentenceItem[]" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Find Sentence Boundaries": { + "$ref": "./examples/FindSentenceBoundaries_MinimumSet_Gen.json" + } + } + } + }, + "/dictionary/examples": { + "post": { + "operationId": "LookupDictionaryExamples", + "summary": "Lookup Dictionary Examples", + "description": "Lookup Dictionary Examples", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "name": "from", + "in": "query", + "required": true, + "description": "Specifies the language of the input text.\nThe source language must be one of the supported languages included in the dictionary scope.", + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": true, + "description": "Specifies the language of the output text.\nThe target language must be one of the supported languages included in the dictionary scope.", + "type": "string" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + }, + { + "name": "requestBody", + "in": "body", + "required": true, + "description": "Defines the content of the request", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryExampleTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryExampleTextItem[]" + } + } + ], + "responses": { + "200": { + "description": "Response for the dictionary examples API.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryExampleItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryExampleItem[]" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Lookup Dictionary Examples": { + "$ref": "./examples/LookupDictionaryExamples_MinimumSet_Gen.json" + } + } + } + }, + "/dictionary/lookup": { + "post": { + "operationId": "LookupDictionaryEntries", + "summary": "Lookup Dictionary Entries", + "description": "Lookup Dictionary Entries", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "name": "from", + "in": "query", + "required": true, + "description": "Specifies the language of the input text.\nThe source language must be one of the supported languages included in the dictionary scope.", + "type": "string" + }, + { + "name": "to", + "in": "query", + "required": true, + "description": "Specifies the language of the output text.\nThe target language must be one of the supported languages included in the dictionary scope.", + "type": "string" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + }, + { + "name": "requestBody", + "in": "body", + "required": true, + "description": "Defines the content of the request", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/InputTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "InputTextItem[]" + } + } + ], + "responses": { + "200": { + "description": "Response for the dictionary lookup API.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryLookupItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryLookupItem[]" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Lookup Dictionary Entries": { + "$ref": "./examples/LookupDictionaryEntries_MinimumSet_Gen.json" + } + } + } + }, + "/languages": { + "get": { + "operationId": "GetLanguages", + "summary": "Gets the set of languages currently supported by other operations of the Translator.", + "description": "Gets the set of languages currently supported by other operations of the Translator.", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "$ref": "#/parameters/GetLanguageParameters.scope" + }, + { + "$ref": "#/parameters/GetLanguageParameters.acceptLanguage" + }, + { + "$ref": "#/parameters/GetLanguageParameters.ifNoneMatch" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + }, + "ETag": { + "description": "Current value of the entity tag for the requested groups of supported languages. \nTo make subsequent requests more efficient, the client may send the `ETag` value in an \n`If-None-Match` header field.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/GetLanguagesResult" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Gets the set of languages currently supported by other operations of the Translator.": { + "$ref": "./examples/GetLanguages_MinimumSet_Gen.json" + } + } + } + }, + "/translate": { + "post": { + "operationId": "Translate", + "summary": "Translate Text", + "description": "Translate Text", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "$ref": "#/parameters/TranslateParameters.to" + }, + { + "$ref": "#/parameters/TranslateParameters.from" + }, + { + "$ref": "#/parameters/TranslateParameters.textType" + }, + { + "$ref": "#/parameters/TranslateParameters.category" + }, + { + "$ref": "#/parameters/TranslateParameters.profanityAction" + }, + { + "$ref": "#/parameters/TranslateParameters.profanityMarker" + }, + { + "$ref": "#/parameters/TranslateParameters.includeAlignment" + }, + { + "$ref": "#/parameters/TranslateParameters.includeSentenceLength" + }, + { + "$ref": "#/parameters/TranslateParameters.suggestedFrom" + }, + { + "$ref": "#/parameters/TranslateParameters.fromScript" + }, + { + "$ref": "#/parameters/TranslateParameters.toScript" + }, + { + "$ref": "#/parameters/TranslateParameters.allowFallback" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + }, + { + "name": "requestBody", + "in": "body", + "required": true, + "description": "Defines the content of the request", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/InputTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "InputTextItem[]" + } + } + ], + "responses": { + "200": { + "description": "Response for the translation API.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + }, + "x-mt-system": { + "description": "Specifies the system type that was used for translation for each 'to' language requested for translation. \nThe value is a comma-separated list of strings. Each string indicates a type:\n\n* Custom - Request includes a custom system and at least one custom system was used during translation.\n* Team - All other requests", + "type": "string" + }, + "x-metered-usage": { + "description": "Specifies consumption (the number of characters for which the user will be charged) for the translation \njob request. For example, if the word \"Hello\" is translated from English (en) to French (fr), \nthis field will return the value '5'.", + "type": "integer", + "format": "int32" + } + }, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TranslatedTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TranslatedTextItem[]" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Translate Text": { + "$ref": "./examples/Translate_MinimumSet_Gen.json" + } + } + } + }, + "/transliterate": { + "post": { + "operationId": "Transliterate", + "summary": "Transliterate Text", + "description": "Transliterate Text", + "parameters": [ + { + "name": "X-ClientTraceId", + "in": "header", + "required": false, + "description": "A client-generated GUID to uniquely identify the request.", + "x-ms-client-name": "clientTraceId", + "type": "string" + }, + { + "$ref": "#/parameters/TransliterateParameters.language" + }, + { + "$ref": "#/parameters/TransliterateParameters.fromScript" + }, + { + "$ref": "#/parameters/TransliterateParameters.toScript" + }, + { + "name": "api-version", + "in": "query", + "required": true, + "description": "Mandatory API version parameter", + "x-ms-client-name": "apiVersion", + "type": "string" + }, + { + "name": "requestBody", + "in": "body", + "required": true, + "description": "Defines the content of the request", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/InputTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "InputTextItem[]" + } + } + ], + "responses": { + "200": { + "description": "Response for the transliteration API.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TransliteratedText" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TransliteratedText[]" + } + }, + "default": { + "description": "An unexpected error response.", + "headers": { + "X-RequestId": { + "description": "Value generated by the service to identify the request. It is used for troubleshooting purposes.", + "type": "string" + } + }, + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Transliterate Text": { + "$ref": "./examples/Transliterate_MinimumSet_Gen.json" + } + } + } + } + }, + "definitions": { + "APIVersion": { + "type": "string", + "description": "Text Translation supported versions", + "enum": [ + "3.0" + ], + "x-ms-enum": { + "name": "APIVersion", + "modelAsString": true, + "values": [ + { + "name": "v3_0", + "value": "3.0" + } + ] + } + }, + "BackTranslation": { + "type": "object", + "properties": { + "normalizedText": { + "type": "string", + "description": "A string giving the normalized form of the source term that is a back-translation of the target.\nThis value should be used as input to lookup examples." + }, + "displayText": { + "type": "string", + "description": "A string giving the source term that is a back-translation of the target in a form best\nsuited for end-user display." + }, + "numExamples": { + "type": "integer", + "format": "int32", + "description": "An integer representing the number of examples that are available for this translation pair.\nActual examples must be retrieved with a separate call to lookup examples. The number is mostly\nintended to facilitate display in a UX. For example, a user interface may add a hyperlink\nto the back-translation if the number of examples is greater than zero and show the back-translation\nas plain text if there are no examples. Note that the actual number of examples returned\nby a call to lookup examples may be less than numExamples, because additional filtering may be\napplied on the fly to remove \"bad\" examples." + }, + "frequencyCount": { + "type": "integer", + "format": "int32", + "description": "An integer representing the frequency of this translation pair in the data. The main purpose of this\nfield is to provide a user interface with a means to sort back-translations so the most frequent terms are first." + } + }, + "description": "Back Translation", + "required": [ + "normalizedText", + "displayText", + "numExamples", + "frequencyCount" + ] + }, + "BreakSentenceItem": { + "type": "object", + "properties": { + "detectedLanguage": { + "$ref": "#/definitions/DetectedLanguage", + "description": "The detectedLanguage property is only present in the result object when language auto-detection is requested." + }, + "sentLen": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "x-typespec-name": "int32[]", + "description": "An integer array representing the lengths of the sentences in the input text.\nThe length of the array is the number of sentences, and the values are the length of each sentence." + } + }, + "description": "Item containing break sentence result.", + "required": [ + "sentLen" + ] + }, + "BreakSentenceResult": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/BreakSentenceItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "BreakSentenceItem[]", + "description": "Array of the break sentence elements." + } + }, + "description": "Response for the Break SEntence API.", + "required": [ + "result" + ] + }, + "CommonScriptModel": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Code identifying the script." + }, + "name": { + "type": "string", + "description": "Display name of the script in the locale requested via Accept-Language header." + }, + "nativeName": { + "type": "string", + "description": "Display name of the language in the locale native for the language." + }, + "dir": { + "type": "string", + "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." + } + }, + "description": "Common properties of language script", + "required": [ + "code", + "name", + "nativeName", + "dir" + ] + }, + "DetectedLanguage": { + "type": "object", + "properties": { + "language": { + "type": "string", + "description": "A string representing the code of the detected language." + }, + "score": { + "type": "number", + "format": "float", + "description": "A float value indicating the confidence in the result.\nThe score is between zero and one and a low score indicates a low confidence." + } + }, + "description": "An object describing the detected language.", + "required": [ + "language", + "score" + ] + }, + "DictionaryExample": { + "type": "object", + "properties": { + "sourcePrefix": { + "type": "string", + "description": "The string to concatenate before the value of sourceTerm to form a complete example.\nDo not add a space character, since it is already there when it should be.\nThis value may be an empty string." + }, + "sourceTerm": { + "type": "string", + "description": "A string equal to the actual term looked up. The string is added with sourcePrefix\nand sourceSuffix to form the complete example. Its value is separated so it can be\nmarked in a user interface, e.g., by bolding it." + }, + "sourceSuffix": { + "type": "string", + "description": "The string to concatenate after the value of sourceTerm to form a complete example.\nDo not add a space character, since it is already there when it should be.\nThis value may be an empty string." + }, + "targetPrefix": { + "type": "string", + "description": "A string similar to sourcePrefix but for the target." + }, + "targetTerm": { + "type": "string", + "description": "A string similar to sourceTerm but for the target." + }, + "targetSuffix": { + "type": "string", + "description": "A string similar to sourceSuffix but for the target." + } + }, + "description": "Dictionary Example", + "required": [ + "sourcePrefix", + "sourceTerm", + "sourceSuffix", + "targetPrefix", + "targetTerm", + "targetSuffix" + ] + }, + "DictionaryExampleItem": { + "type": "object", + "properties": { + "normalizedSource": { + "type": "string", + "description": "A string giving the normalized form of the source term. Generally, this should be identical\nto the value of the Text field at the matching list index in the body of the request." + }, + "normalizedTarget": { + "type": "string", + "description": "A string giving the normalized form of the target term. Generally, this should be identical\nto the value of the Translation field at the matching list index in the body of the request." + }, + "examples": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryExample" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryExample[]", + "description": "A list of examples for the (source term, target term) pair." + } + }, + "description": "Dictionary Example element", + "required": [ + "normalizedSource", + "normalizedTarget", + "examples" + ] + }, + "DictionaryExampleTextItem": { + "type": "object", + "properties": { + "translation": { + "type": "string", + "description": "A string specifying the translated text previously returned by the Dictionary lookup operation. \nThis should be the value from the normalizedTarget field in the translations list of the Dictionary \nlookup response. The service will return examples for the specific source-target word-pair." + } + }, + "description": "Element containing the text with translation.", + "required": [ + "translation" + ], + "allOf": [ + { + "$ref": "#/definitions/InputTextItem" + } + ] + }, + "DictionaryExamplesParameters": { + "type": "object", + "properties": { + "from": { + "type": "string", + "description": "Specifies the language of the input text.\nThe source language must be one of the supported languages included in the dictionary scope." + }, + "to": { + "type": "string", + "description": "Specifies the language of the output text.\nThe target language must be one of the supported languages included in the dictionary scope." + } + }, + "description": "Request parameters for the dictionary examples API.", + "required": [ + "from", + "to" + ] + }, + "DictionaryExamplesResult": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryExampleItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryExampleItem[]", + "description": "Array of the dictionary examples elements." + } + }, + "description": "Response for the dictionary examples API.", + "required": [ + "result" + ] + }, + "DictionaryLookupItem": { + "type": "object", + "properties": { + "normalizedSource": { + "type": "string", + "description": "A string giving the normalized form of the source term.\nFor example, if the request is \"JOHN\", the normalized form will be \"john\".\nThe content of this field becomes the input to lookup examples." + }, + "displaySource": { + "type": "string", + "description": "A string giving the source term in a form best suited for end-user display.\nFor example, if the input is \"JOHN\", the display form will reflect the usual\nspelling of the name: \"John\"." + }, + "translations": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryTranslation" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryTranslation[]", + "description": "A list of translations for the source term." + } + }, + "description": "Dictionary Lookup Element", + "required": [ + "normalizedSource", + "displaySource", + "translations" + ] + }, + "DictionaryLookupParameters": { + "type": "object", + "properties": { + "from": { + "type": "string", + "description": "Specifies the language of the input text.\nThe source language must be one of the supported languages included in the dictionary scope." + }, + "to": { + "type": "string", + "description": "Specifies the language of the output text.\nThe target language must be one of the supported languages included in the dictionary scope." + } + }, + "description": "Request parameters for the dictionary lookup API.", + "required": [ + "from", + "to" + ] + }, + "DictionaryLookupResult": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/DictionaryLookupItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "DictionaryLookupItem[]", + "description": "Array of the dictionary lookup elements." + } + }, + "description": "Response for the dictionary lookup API.", + "required": [ + "result" + ] + }, + "DictionaryTranslation": { + "type": "object", + "properties": { + "normalizedTarget": { + "type": "string", + "description": "A string giving the normalized form of this term in the target language.\nThis value should be used as input to lookup examples." + }, + "displayTarget": { + "type": "string", + "description": "A string giving the term in the target language and in a form best suited\nfor end-user display. Generally, this will only differ from the normalizedTarget\nin terms of capitalization. For example, a proper noun like \"Juan\" will have\nnormalizedTarget = \"juan\" and displayTarget = \"Juan\"." + }, + "posTag": { + "type": "string", + "description": "A string associating this term with a part-of-speech tag." + }, + "confidence": { + "type": "number", + "format": "float", + "description": "A value between 0.0 and 1.0 which represents the \"confidence\" \n(or perhaps more accurately, \"probability in the training data\") of that translation pair. \nThe sum of confidence scores for one source word may or may not sum to 1.0." + }, + "prefixWord": { + "type": "string", + "description": "A string giving the word to display as a prefix of the translation. Currently,\nthis is the gendered determiner of nouns, in languages that have gendered determiners.\nFor example, the prefix of the Spanish word \"mosca\" is \"la\", since \"mosca\" is a feminine noun in Spanish. \nThis is only dependent on the translation, and not on the source. \nIf there is no prefix, it will be the empty string." + }, + "backTranslations": { + "type": "array", + "items": { + "$ref": "#/definitions/BackTranslation" + }, + "x-ms-identifiers": [], + "x-typespec-name": "BackTranslation[]", + "description": "A list of \"back translations\" of the target. For example, source words that the target can translate to.\nThe list is guaranteed to contain the source word that was requested (e.g., if the source word being\nlooked up is \"fly\", then it is guaranteed that \"fly\" will be in the backTranslations list).\nHowever, it is not guaranteed to be in the first position, and often will not be." + } + }, + "description": "Translation source term.", + "required": [ + "normalizedTarget", + "displayTarget", + "posTag", + "confidence", + "prefixWord", + "backTranslations" + ] + }, + "ErrorDetails": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "Number identifier of the error." + }, + "message": { + "type": "string", + "description": "Human readable error description." + } + }, + "description": "Error details as returned by Translator Service.", + "required": [ + "code", + "message" + ] + }, + "ErrorResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorDetails", + "description": "Error details." + } + }, + "description": "Representation of the Error Response from Translator Service.", + "required": [ + "error" + ] + }, + "GetLanguagesResult": { + "type": "object", + "properties": { + "translation": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/TranslationLanguage" + }, + "x-typespec-name": "Record", + "description": "Languages that support translate API." + }, + "transliteration": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/TransliterationLanguage" + }, + "x-typespec-name": "Record", + "description": "Languages that support transliteration API." + }, + "dictionary": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SourceDictionaryLanguage" + }, + "x-typespec-name": "Record", + "description": "Languages that support dictionary API." + } + }, + "description": "Response for the languages API." + }, + "InputTextItem": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "Text to translate." + } + }, + "description": "Element containing the text for translation.", + "required": [ + "text" + ] + }, + "ProfanityAction": { + "type": "string", + "enum": [ + "NoAction", + "Marked", + "Deleted" + ], + "x-ms-enum": { + "name": "ProfanityAction", + "modelAsString": true, + "values": [ + { + "name": "NoAction", + "value": "NoAction" + }, + { + "name": "Marked", + "value": "Marked" + }, + { + "name": "Deleted", + "value": "Deleted" + } + ] + } + }, + "ProfanityActionKnownValues": { + "type": "string", + "enum": [ + "NoAction", + "Marked", + "Deleted" + ], + "x-ms-enum": { + "name": "ProfanityActionKnownValues", + "modelAsString": true, + "values": [ + { + "name": "NoAction", + "value": "NoAction" + }, + { + "name": "Marked", + "value": "Marked" + }, + { + "name": "Deleted", + "value": "Deleted" + } + ] + } + }, + "ProfanityMarker": { + "type": "string", + "enum": [ + "Asterisk", + "Tag" + ], + "x-ms-enum": { + "name": "ProfanityMarker", + "modelAsString": true, + "values": [ + { + "name": "Asterisk", + "value": "Asterisk" + }, + { + "name": "Tag", + "value": "Tag" + } + ] + } + }, + "ProfanityMarkerKnownValues": { + "type": "string", + "enum": [ + "Asterisk", + "Tag" + ], + "x-ms-enum": { + "name": "ProfanityMarkerKnownValues", + "modelAsString": true, + "values": [ + { + "name": "Asterisk", + "value": "Asterisk" + }, + { + "name": "Tag", + "value": "Tag" + } + ] + } + }, + "SentenceLength": { + "type": "object", + "properties": { + "srcSentLen": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "x-typespec-name": "int32[]", + "description": "An integer array representing the lengths of the sentences in the input text. \nThe length of the array is the number of sentences, and the values are the length of each sentence." + }, + "transSentLen": { + "type": "array", + "items": { + "type": "integer", + "format": "int32" + }, + "x-typespec-name": "int32[]", + "description": "An integer array representing the lengths of the sentences in the translated text. \nThe length of the array is the number of sentences, and the values are the length of each sentence." + } + }, + "description": "An object returning sentence boundaries in the input and output texts.", + "required": [ + "srcSentLen", + "transSentLen" + ] + }, + "SourceDictionaryLanguage": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Display name of the language in the locale requested via Accept-Language header." + }, + "nativeName": { + "type": "string", + "description": "Display name of the language in the locale native for this language." + }, + "dir": { + "type": "string", + "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." + }, + "translations": { + "type": "array", + "items": { + "$ref": "#/definitions/TargetDictionaryLanguage" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TargetDictionaryLanguage[]", + "description": "List of languages with alterative translations and examples for the query expressed in the source language." + } + }, + "description": "Properties ot the source dictionary language", + "required": [ + "name", + "nativeName", + "dir", + "translations" + ] + }, + "SourceText": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "Input text in the default script of the source language." + } + }, + "description": "Input text in the default script of the source language. ", + "required": [ + "text" + ] + }, + "TargetDictionaryLanguage": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Display name of the language in the locale requested via Accept-Language header." + }, + "nativeName": { + "type": "string", + "description": "Display name of the language in the locale native for this language." + }, + "dir": { + "type": "string", + "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." + }, + "code": { + "type": "string", + "description": "Language code identifying the target language." + } + }, + "description": "Properties of the target dictionary language", + "required": [ + "name", + "nativeName", + "dir", + "code" + ] + }, + "TextType": { + "type": "string", + "enum": [ + "Plain", + "Html" + ], + "x-ms-enum": { + "name": "TextType", + "modelAsString": true, + "values": [ + { + "name": "Plain", + "value": "Plain" + }, + { + "name": "Html", + "value": "Html" + } + ] + } + }, + "TextTypeKnownValues": { + "type": "string", + "enum": [ + "Plain", + "Html" + ], + "x-ms-enum": { + "name": "TextTypeKnownValues", + "modelAsString": true, + "values": [ + { + "name": "Plain", + "value": "Plain" + }, + { + "name": "Html", + "value": "Html" + } + ] + } + }, + "TranslatedTextAlignment": { + "type": "object", + "properties": { + "proj": { + "type": "string", + "description": "Maps input text to translated text. The alignment information is only provided when the request \nparameter includeAlignment is true. Alignment is returned as a string value of the following \nformat: [[SourceTextStartIndex]:[SourceTextEndIndex]–[TgtTextStartIndex]:[TgtTextEndIndex]]. \nThe colon separates start and end index, the dash separates the languages, and space separates the words. \nOne word may align with zero, one, or multiple words in the other language, and the aligned words may \nbe non-contiguous. When no alignment information is available, the alignment element will be empty." + } + }, + "description": "Alignment information object.", + "required": [ + "proj" + ] + }, + "TranslatedTextItem": { + "type": "object", + "properties": { + "detectedLanguage": { + "$ref": "#/definitions/DetectedLanguage", + "description": "The detectedLanguage property is only present in the result object when language auto-detection is requested." + }, + "translations": { + "type": "array", + "items": { + "$ref": "#/definitions/Translation" + }, + "x-ms-identifiers": [], + "x-typespec-name": "Translation[]", + "description": "An array of translation results. The size of the array matches the number of target \nlanguages specified through the to query parameter." + }, + "sourceText": { + "$ref": "#/definitions/SourceText", + "description": "Input text in the default script of the source language. sourceText property is present only when \nthe input is expressed in a script that's not the usual script for the language. For example, \nif the input were Arabic written in Latin script, then sourceText.text would be the same Arabic text \nconverted into Arab script." + } + }, + "description": "Element containing the translated text", + "required": [ + "translations" + ] + }, + "Translation": { + "type": "object", + "properties": { + "to": { + "type": "string", + "description": "A string representing the language code of the target language." + }, + "text": { + "type": "string", + "description": "A string giving the translated text." + }, + "transliteration": { + "$ref": "#/definitions/TransliteratedText", + "description": "An object giving the translated text in the script specified by the toScript parameter." + }, + "alignment": { + "$ref": "#/definitions/TranslatedTextAlignment", + "description": "Alignment information." + }, + "sentLen": { + "$ref": "#/definitions/SentenceLength", + "description": "Sentence boundaries in the input and output texts." + } + }, + "description": "Translation result", + "required": [ + "to", + "text" + ] + }, + "TranslationLanguage": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Display name of the language in the locale requested via Accept-Language header." + }, + "nativeName": { + "type": "string", + "description": "Display name of the language in the locale native for this language." + }, + "dir": { + "type": "string", + "description": "Directionality, which is rtl for right-to-left languages or ltr for left-to-right languages." + } + }, + "description": "The value of the translation property is a dictionary of (key, value) pairs. Each key is a BCP 47 language tag.\nA key identifies a language for which text can be translated to or translated from.", + "required": [ + "name", + "nativeName", + "dir" + ] + }, + "TranslationResult": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TranslatedTextItem" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TranslatedTextItem[]", + "description": "Array of the translated text elements." + } + }, + "description": "Response for the translation API.", + "required": [ + "result" + ] + }, + "TransliterableScript": { + "type": "object", + "properties": { + "toScripts": { + "type": "array", + "items": { + "$ref": "#/definitions/CommonScriptModel" + }, + "x-ms-identifiers": [], + "x-typespec-name": "CommonScriptModel[]", + "description": "List of scripts available to convert text to." + } + }, + "description": "Script definition with list of script into which given script can be translitered.", + "required": [ + "toScripts" + ], + "allOf": [ + { + "$ref": "#/definitions/CommonScriptModel" + } + ] + }, + "TransliterateResult": { + "type": "object", + "properties": { + "result": { + "type": "array", + "items": { + "$ref": "#/definitions/TransliteratedText" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TransliteratedText[]", + "description": "Array of transliterated texts" + } + }, + "description": "Response for the transliteration API.", + "required": [ + "result" + ] + }, + "TransliteratedText": { + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "A string which is the result of converting the input string to the output script." + }, + "script": { + "type": "string", + "description": "A string specifying the script used in the output." + } + }, + "description": "Transliterated text element.", + "required": [ + "text", + "script" + ] + }, + "TransliterationLanguage": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Display name of the language in the locale requested via Accept-Language header." + }, + "nativeName": { + "type": "string", + "description": "Display name of the language in the locale native for this language." + }, + "scripts": { + "type": "array", + "items": { + "$ref": "#/definitions/TransliterableScript" + }, + "x-ms-identifiers": [], + "x-typespec-name": "TransliterableScript[]", + "description": "List of scripts to convert from." + } + }, + "description": "The value of the transliteration property is a dictionary of (key, value) pairs. \nEach key is a BCP 47 language tag. A key identifies a language for which text can be converted from one script \nto another script.", + "required": [ + "name", + "nativeName", + "scripts" + ] + } + }, + "parameters": { + "BreakSentenceParameters.language": { + "name": "language", + "in": "query", + "required": false, + "description": "Language tag identifying the language of the input text. \nIf a code isn't specified, automatic language detection will be applied.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "BreakSentenceParameters.script": { + "name": "script", + "in": "query", + "required": false, + "description": "Script tag identifying the script used by the input text. \nIf a script isn't specified, the default script of the language will be assumed.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "GetLanguageParameters.acceptLanguage": { + "name": "Accept-Language", + "in": "header", + "required": false, + "description": "The language to use for user interface strings. Some of the fields in the response are names of languages or \nnames of regions. Use this parameter to define the language in which these names are returned. \nThe language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` \nto request names in French or use the value `zh-Hant` to request names in Chinese Traditional.\nNames are provided in the English language when a target language is not specified or when localization \nis not available.", + "x-ms-client-name": "acceptLanguage", + "default": "en", + "type": "string", + "x-ms-parameter-location": "method" + }, + "GetLanguageParameters.ifNoneMatch": { + "name": "If-None-Match", + "in": "header", + "required": false, + "description": "Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. \nIf the resource has not been modified, the service will return status code 304 and an empty response body.", + "x-ms-client-name": "ifNoneMatch", + "type": "string", + "x-ms-parameter-location": "method" + }, + "GetLanguageParameters.scope": { + "name": "scope", + "in": "query", + "required": false, + "description": "A comma-separated list of names defining the group of languages to return.\nAllowed group names are: `translation`, `transliteration` and `dictionary`.\nIf no scope is given, then all groups are returned, which is equivalent to passing \n`scope=translation,transliteration,dictionary`. To decide which set of supported languages \nis appropriate for your scenario, see the description of the [response object](#response-body).", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.allowFallback": { + "name": "allowFallback", + "in": "query", + "required": false, + "description": "Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. \nPossible values are: true (default) or false.\n\nallowFallback=false specifies that the translation should only use systems trained for the category specified \nby the request. If a translation for language X to language Y requires chaining through a pivot language E, \nthen all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. \nIf no system is found with the specific category, the request will return a 400 status code. allowFallback=true \nspecifies that the service is allowed to fall back to a general system when a custom system doesn't exist.", + "default": true, + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.category": { + "name": "category", + "in": "query", + "required": false, + "description": "A string specifying the category (domain) of the translation. This parameter is used to get translations \nfrom a customized system built with Custom Translator. Add the Category ID from your Custom Translator \nproject details to this parameter to use your deployed customized system. Default value is: general.", + "default": "general", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.from": { + "name": "from", + "in": "query", + "required": false, + "description": "Specifies the language of the input text. Find which languages are available to translate from by \nlooking up supported languages using the translation scope. If the from parameter isn't specified, \nautomatic language detection is applied to determine the source language.\n\nYou must use the from parameter rather than autodetection when using the dynamic dictionary feature. \nNote: the dynamic dictionary feature is case-sensitive.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.fromScript": { + "name": "fromScript", + "in": "query", + "required": false, + "description": "Specifies the script of the input text.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.includeAlignment": { + "name": "includeAlignment", + "in": "query", + "required": false, + "description": "Specifies whether to include alignment projection from source text to translated text.\nPossible values are: true or false (default).", + "default": false, + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.includeSentenceLength": { + "name": "includeSentenceLength", + "in": "query", + "required": false, + "description": "Specifies whether to include sentence boundaries for the input text and the translated text.\nPossible values are: true or false (default).", + "default": false, + "type": "boolean", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.profanityAction": { + "name": "profanityAction", + "in": "query", + "required": false, + "default": "NoAction", + "type": "string", + "enum": [ + "NoAction", + "Marked", + "Deleted" + ], + "x-ms-enum": { + "name": "ProfanityAction", + "modelAsString": true, + "values": [ + { + "name": "NoAction", + "value": "NoAction" + }, + { + "name": "Marked", + "value": "Marked" + }, + { + "name": "Deleted", + "value": "Deleted" + } + ] + }, + "x-ms-parameter-location": "method" + }, + "TranslateParameters.profanityMarker": { + "name": "profanityMarker", + "in": "query", + "required": false, + "default": "Asterisk", + "type": "string", + "enum": [ + "Asterisk", + "Tag" + ], + "x-ms-enum": { + "name": "ProfanityMarker", + "modelAsString": true, + "values": [ + { + "name": "Asterisk", + "value": "Asterisk" + }, + { + "name": "Tag", + "value": "Tag" + } + ] + }, + "x-ms-parameter-location": "method" + }, + "TranslateParameters.suggestedFrom": { + "name": "suggestedFrom", + "in": "query", + "required": false, + "description": "Specifies a fallback language if the language of the input text can't be identified. \nLanguage autodetection is applied when the from parameter is omitted. If detection fails, \nthe suggestedFrom language will be assumed.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TranslateParameters.textType": { + "name": "textType", + "in": "query", + "required": false, + "default": "Plain", + "type": "string", + "enum": [ + "Plain", + "Html" + ], + "x-ms-enum": { + "name": "TextType", + "modelAsString": true, + "values": [ + { + "name": "Plain", + "value": "Plain" + }, + { + "name": "Html", + "value": "Html" + } + ] + }, + "x-ms-parameter-location": "method" + }, + "TranslateParameters.to": { + "name": "to", + "in": "query", + "required": true, + "description": "Specifies the language of the output text. The target language must be one of the supported languages included \nin the translation scope. For example, use to=de to translate to German.\nIt's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. \nFor example, use to=de&to=it to translate to German and Italian.", + "collectionFormat": "multi", + "type": "array", + "items": { + "type": "string" + }, + "x-ms-parameter-location": "method" + }, + "TranslateParameters.toScript": { + "name": "toScript", + "in": "query", + "required": false, + "description": "Specifies the script of the translated text.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TransliterateParameters.fromScript": { + "name": "fromScript", + "in": "query", + "required": true, + "description": "Specifies the script used by the input text. Look up supported languages using the transliteration scope,\nto find input scripts available for the selected language.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TransliterateParameters.language": { + "name": "language", + "in": "query", + "required": true, + "description": "Specifies the language of the text to convert from one script to another. \nPossible languages are listed in the transliteration scope obtained by querying the service \nfor its supported languages.", + "type": "string", + "x-ms-parameter-location": "method" + }, + "TransliterateParameters.toScript": { + "name": "toScript", + "in": "query", + "required": true, + "description": "Specifies the output script. Look up supported languages using the transliteration scope, to find output \nscripts available for the selected combination of input language and input script.", + "type": "string", + "x-ms-parameter-location": "method" + } + } +}