From fcf2f68b75f3782aec2a2cf21b6f13f700db2069 Mon Sep 17 00:00:00 2001 From: Rango Meadows Date: Fri, 15 Sep 2023 16:38:57 -0700 Subject: [PATCH 1/4] Options Parameter for Translate and Transliterate --- .../Azure.AI.Translation.Text/README.md | 60 +++- .../samples/Sample2_Translate.md | 36 ++- .../samples/Sample3_Transliterate.md | 26 ++ .../samples/Sample4_BreakSentence.md | 4 +- .../src/Custom/TextTranslationClient.cs | 45 +++ .../Custom/TextTranslationTranslateOptions.cs | 175 +++++++++++ .../TextTranslationTransliterateOptions.cs | 68 +++++ .../Samples/Samples_TextTranslationClient.cs | 6 + .../tests/Samples/SampleSnippets.cs | 86 +++++- .../tests/TranslationLiveTests.cs | 272 ++++++++++++++++++ .../tests/TransliterationLiveTests.cs | 68 +++++ 11 files changed, 831 insertions(+), 15 deletions(-) create mode 100644 sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs create mode 100644 sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs diff --git a/sdk/translation/Azure.AI.Translation.Text/README.md b/sdk/translation/Azure.AI.Translation.Text/README.md index d0a4bb6e7ff9c..50c2bccd4e2eb 100644 --- a/sdk/translation/Azure.AI.Translation.Text/README.md +++ b/sdk/translation/Azure.AI.Translation.Text/README.md @@ -146,6 +146,38 @@ catch (RequestFailedException exception) } ``` +A convenience overload of Translate is provided using a single TextTranslationTranslateOptions parameter. This sample demonstrates Translation and Transliteration in a single call using the options parameter. + +```C# Snippet:GetTranslationTextTransliteratedOptions +try +{ + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + { + FromScript = "Latn", + SourceLanguage = "ar", + ToScript = "Latn", + TargetLanguages = new[] { "zh-Hans" }, + Content = new[] + { + "hudha akhtabar." + } + }; + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + TranslatedTextItem translation = translations.FirstOrDefault(); + + Console.WriteLine($"Source Text: {translation.SourceText.Text}"); + Console.WriteLine($"Translation: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + Console.WriteLine($"Transliterated text ({translation?.Translations?.FirstOrDefault()?.Transliteration?.Script}): {translation?.Translations?.FirstOrDefault()?.Transliteration?.Text}"); +} +catch (RequestFailedException exception) +{ + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); +} +``` + For samples on using the `translate` endpoint refer to more samples [here][translate_sample]. Please refer to the service documentation for a conceptual discussion of [translate][translate_doc]. @@ -176,6 +208,32 @@ catch (RequestFailedException exception) } ``` +A convenience overload of Transliterate is provided using a single TextTranslationTransliterateOptions parameter. A modified version of the preceding sample is provided here demonstrating its use. + +```C# Snippet:GetTransliteratedTextOptions +try +{ + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() + { + Language = "zh-Hans", + FromScript = "Hans", + ToScript = "Latn", + Content = new[] { "这是个测试。" } + }; + + Response> response = client.Transliterate(options); + IReadOnlyList transliterations = response.Value; + TransliteratedText transliteration = transliterations.FirstOrDefault(); + + Console.WriteLine($"Input text was transliterated to '{transliteration?.Script}' script. Transliterated text: '{transliteration?.Text}'."); +} +catch (RequestFailedException exception) +{ + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); +} +``` + For samples on using the `transliterate` endpoint refer to more samples [here][transliterate_sample]. Please refer to the service documentation for a conceptual discussion of [transliterate][transliterate_doc]. @@ -194,7 +252,7 @@ try BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md index 8824c5cc72dc6..5b5c8b124c7a2 100644 --- a/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md +++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md @@ -85,6 +85,38 @@ catch (RequestFailedException exception) } ``` +A convenience overload of Translate is provided using a single TextTranslationTranslateOptions parameter. This sample demonstrates Translation and Transliteration in a single call using the options parameter. + +```C# Snippet:GetTranslationTextTransliteratedOptions +try +{ + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + { + FromScript = "Latn", + SourceLanguage = "ar", + ToScript = "Latn", + TargetLanguages = new[] { "zh-Hans" }, + Content = new[] + { + "hudha akhtabar." + } + }; + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + TranslatedTextItem translation = translations.FirstOrDefault(); + + Console.WriteLine($"Source Text: {translation.SourceText.Text}"); + Console.WriteLine($"Translation: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + Console.WriteLine($"Transliterated text ({translation?.Translations?.FirstOrDefault()?.Transliteration?.Script}): {translation?.Translations?.FirstOrDefault()?.Transliteration?.Text}"); +} +catch (RequestFailedException exception) +{ + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); +} +``` + ## Translate multiple input texts You can translate multiple text elements. Each input element can be in different language (source language parameter needs to be omitted and language auto-detection is used). Refer to [Request limits for Translator](https://learn.microsoft.com/azure/cognitive-services/translator/request-limits) for current limits. @@ -314,8 +346,8 @@ try Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); - Console.WriteLine($"Source Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); - Console.WriteLine($"Translated Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); + Console.WriteLine($"Source Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); + Console.WriteLine($"Translated Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); } catch (RequestFailedException exception) { diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md index d5927f7180263..a8427788bfff6 100644 --- a/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md +++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md @@ -28,6 +28,32 @@ catch (RequestFailedException exception) } ``` +A convenience overload of Transliterate is provided using a single TextTranslationTransliterateOptions parameter. A modified version of the preceding sample is provided here demonstrating its use. + +```C# Snippet:GetTransliteratedTextOptions +try +{ + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() + { + Language = "zh-Hans", + FromScript = "Hans", + ToScript = "Latn", + Content = new[] { "这是个测试。" } + }; + + Response> response = client.Transliterate(options); + IReadOnlyList transliterations = response.Value; + TransliteratedText transliteration = transliterations.FirstOrDefault(); + + Console.WriteLine($"Input text was transliterated to '{transliteration?.Script}' script. Transliterated text: '{transliteration?.Text}'."); +} +catch (RequestFailedException exception) +{ + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); +} +``` + See the [README] of the Text Translation client library for more information, including useful links and instructions. [README]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/translation/Azure.AI.Translation.Text/README.md diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md index 46533ad1c4d48..d0f65ca85d0cd 100644 --- a/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md +++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample4_BreakSentence.md @@ -21,7 +21,7 @@ try BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -47,7 +47,7 @@ try BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs index 022ce5466e358..ac02f2592ce37 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationClient.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Linq; using System.Text.Json; +using System.Security.Principal; namespace Azure.AI.Translation.Text { @@ -186,6 +187,17 @@ public virtual Task>> TranslateAsync( return this.TranslateAsync(targetLanguages, content.Select(input => new InputTextItem(input)), clientTraceId, sourceLanguage, textType?.ToString(), category, profanityAction?.ToString(), profanityMarker?.ToString(), includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, cancellationToken); } + /// Translate Text. + /// The client translation options. + /// The cancellation token to use. + /// is null. + public virtual Task>> TranslateAsync(TextTranslationTranslateOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return this.TranslateAsync(options.TargetLanguages, options.Content.Select(input => new InputTextItem(input)), options.ClientTraceId, options.SourceLanguage, options.TextType?.ToString(), options.Category, options.ProfanityAction?.ToString(), options.ProfanityMarker?.ToString(), options.IncludeAlignment, options.IncludeSentenceLength, options.SuggestedFrom, options.FromScript, options.ToScript, options.AllowFallback, cancellationToken); + } + /// Translate Text. /// /// Specifies the language of the output text. The target language must be one of the supported languages included @@ -307,6 +319,17 @@ public virtual Response> Translate(IEnumerable return this.Translate(targetLanguages, content.Select(input => new InputTextItem(input)), clientTraceId, sourceLanguage, textType?.ToString(), category, profanityAction?.ToString(), profanityMarker?.ToString(), includeAlignment, includeSentenceLength, suggestedFrom, fromScript, toScript, allowFallback, cancellationToken); } + /// Translate Text. + /// The client translation options. + /// The cancellation token to use. + /// is null. + public virtual Response> Translate(TextTranslationTranslateOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return this.Translate(options.TargetLanguages, options.Content.Select(input => new InputTextItem(input)), options.ClientTraceId, options.SourceLanguage, options.TextType?.ToString(), options.Category, options.ProfanityAction?.ToString(), options.ProfanityMarker?.ToString(), options.IncludeAlignment, options.IncludeSentenceLength, options.SuggestedFrom, options.FromScript, options.ToScript, options.AllowFallback, cancellationToken); + } + /// Translate Text. /// /// Specifies the language of the output text. The target language must be one of the supported languages included @@ -387,6 +410,17 @@ public virtual Task>> TransliterateAs return this.TransliterateAsync(language, fromScript, toScript, content.Select(input => new InputTextItem(input)), clientTraceId, cancellationToken); } + /// Transliterate Text. + /// + /// + /// A representing the result of the asynchronous operation. + public virtual Task>> TransliterateAsync(TextTranslationTransliterateOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return this.TransliterateAsync(options.Language, options.FromScript, options.ToScript, options.Content.Select(input => new InputTextItem(input)), options.ClientTraceId, cancellationToken); + } + /// Transliterate Text. /// /// Specifies the language of the text to convert from one script to another. @@ -442,6 +476,17 @@ public virtual Response> Transliterate(string return this.Transliterate(language, fromScript, toScript, content.Select(input => new InputTextItem(input)), clientTraceId, cancellationToken); } + /// Transliterate Text. + /// The configuration options for the transliterate call. + /// The cancellation token to use. + /// is null. + public virtual Response> Transliterate(TextTranslationTransliterateOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + return this.Transliterate(options.Language, options.FromScript, options.ToScript, options.Content.Select(input => new InputTextItem(input)), options.ClientTraceId, cancellationToken); + } + /// Transliterate Text. /// /// Specifies the language of the text to convert from one script to another. diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs new file mode 100644 index 0000000000000..7c3aa531bcd10 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using System.Collections.Generic; + +namespace Azure.AI.Translation.Text +{ + /// Client options for TextTranslationClient.Translate + public partial class TextTranslationTranslateOptions : ClientOptions + { + /// + /// 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 and to=it to translate to German and Italian. + /// + public IEnumerable TargetLanguages { get; set; } + /// + /// Array of the text to be translated. + /// + public IEnumerable Content { get; set; } + /// + /// A client-generated GUID to uniquely identify the request. + /// + public string ClientTraceId { get; set; } + /// + /// 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. + /// + public string SourceLanguage { get; set; } + /// + /// 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. + /// + public TextType? TextType { get; set; } + /// + /// 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. + /// + public string Category { get; set; } + /// + /// Specifies how profanities should be treated in translations. + /// Possible values are: NoAction (default), Marked or Deleted. + /// + public ProfanityAction? ProfanityAction { get; set; } + /// + /// Specifies how profanities should be marked in translations. + /// Possible values are: Asterisk (default) or Tag. + /// + public ProfanityMarker? ProfanityMarker { get; set; } + /// + /// Specifies whether to include alignment projection from source text to translated text. + /// Possible values are: true or false (default). + /// + public bool? IncludeAlignment { get; set; } + /// + /// Specifies whether to include sentence boundaries for the input text and the translated text. + /// Possible values are: true or false (default). + /// + public bool? IncludeSentenceLength { get; set; } + /// + /// 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. + /// + public string SuggestedFrom { get; set; } + /// + /// Specifies the script of the input text. + /// + public string FromScript { get; set; } + /// + /// Specifies the script of the translated text. + /// + public string ToScript { get; set; } + /// + /// 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. + /// + public bool? AllowFallback { get; set; } + + /// Initializes new instance of TextTranslationTranslateOptions. + public TextTranslationTranslateOptions(): base() + { + } + + /// Initializes new instance of TextTranslationTranslateOptions. + /// + /// 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. + /// + /// Array of the text to be translated. + /// A client-generated GUID to uniquely identify the request. + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// Specifies how profanities should be treated in translations. + /// Possible values are: NoAction (default), Marked or Deleted. + /// + /// + /// Specifies how profanities should be marked in translations. + /// Possible values are: Asterisk (default) or Tag. + /// + /// + /// Specifies whether to include alignment projection from source text to translated text. + /// Possible values are: true or false (default). + /// + /// + /// Specifies whether to include sentence boundaries for the input text and the translated text. + /// Possible values are: true or false (default). + /// + /// + /// 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. + /// + /// Specifies the script of the input text. + /// Specifies the script of the translated text. + /// + /// 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. + /// + public TextTranslationTranslateOptions(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null): base() + { + TargetLanguages = targetLanguages; + Content = content; + ClientTraceId = clientTraceId; + SourceLanguage = sourceLanguage; + TextType = textType; + Category = category; + ProfanityAction = profanityAction; + ProfanityMarker = profanityMarker; + IncludeAlignment = includeAlignment; + IncludeSentenceLength = includeSentenceLength; + SuggestedFrom = suggestedFrom; + FromScript = fromScript; + ToScript = toScript; + AllowFallback = allowFallback; + } + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs new file mode 100644 index 0000000000000..a039304952757 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using System.Collections.Generic; + +namespace Azure.AI.Translation.Text +{ + /// Client options for TextTranslationClient.Transliterate + public partial class TextTranslationTransliterateOptions : ClientOptions + { + /// + /// 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. + /// + public string Language { get; set; } + /// + /// 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. + /// + public string FromScript { get; set; } + /// + /// 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. + /// + public string ToScript { get; set; } + /// + /// Array of the text to be transliterated. + /// + public IEnumerable Content { get; set; } + /// + /// A client-generated GUID to uniquely identify the request. + /// + public string ClientTraceId { get; set; } + + /// Initializes new instance of TextTranslationTransliterateOptions. + public TextTranslationTransliterateOptions(): base() + { + } + + /// Initializes new instance of TextTranslationTransliterateOptions. + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// Array of the text to be transliterated. + /// A client-generated GUID to uniquely identify the request. + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null): base() + { + Language = language; + Content = content; + FromScript = fromScript; + ToScript = toScript; + Content = content; + ClientTraceId = clientTraceId; + } + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs index 597827a76267c..403084b6e93dd 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs @@ -5,6 +5,12 @@ #nullable disable +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; +using Azure; +using Azure.Core; using Azure.Identity; namespace Azure.AI.Translation.Text.Samples diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs b/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs index d9affd436b1f0..9d1feb1a6e7bd 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs @@ -1007,8 +1007,8 @@ public void GetTextTranslationSentences() Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); - Console.WriteLine($"Source Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); - Console.WriteLine($"Translated Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); + Console.WriteLine($"Source Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); + Console.WriteLine($"Translated Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); } catch (RequestFailedException exception) { @@ -1039,8 +1039,8 @@ public async void GetTextTranslationSentencesAsync() Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); - Console.WriteLine($"Source Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); - Console.WriteLine($"Translated Sentece length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); + Console.WriteLine($"Source Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.SrcSentLen)}"); + Console.WriteLine($"Translated Sentence length: {string.Join(",", translation?.Translations?.FirstOrDefault()?.SentLen?.TransSentLen)}"); } catch (RequestFailedException exception) { @@ -1127,7 +1127,7 @@ public void GetTextTranslationSentencesSource() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -1156,7 +1156,7 @@ public async void GetTextTranslationSentencesSourceAsync() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -1182,7 +1182,7 @@ public void GetTextTranslationSentencesAuto() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -1208,7 +1208,7 @@ public async void GetTextTranslationSentencesAutoAsync() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -1245,6 +1245,36 @@ public void GetTransliteratedText() #endregion } + [Test] + public void GetTransliteratedTextOptions() + { + TextTranslationClient client = CreateTextTranslationClient(); + + #region Snippet:GetTransliteratedTextOptions + try + { + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() + { + Language = "zh-Hans", + FromScript = "Hans", + ToScript = "Latn", + Content = new[] { "这是个测试。" } + }; + + Response> response = client.Transliterate(options); + IReadOnlyList transliterations = response.Value; + TransliteratedText transliteration = transliterations.FirstOrDefault(); + + Console.WriteLine($"Input text was transliterated to '{transliteration?.Script}' script. Transliterated text: '{transliteration?.Text}'."); + } + catch (RequestFailedException exception) + { + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); + } + #endregion + } + [Test] public async void GetTransliteratedTextAsync() { @@ -1304,6 +1334,42 @@ public void GetTranslationTextTransliterated() #endregion } + [Test] + public void GetTranslationTextTransliteratedOptions() + { + TextTranslationClient client = CreateTextTranslationClient(); + + #region Snippet:GetTranslationTextTransliteratedOptions + try + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + { + FromScript = "Latn", + SourceLanguage = "ar", + ToScript = "Latn", + TargetLanguages = new[] { "zh-Hans" }, + Content = new[] + { + "hudha akhtabar." + } + }; + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + TranslatedTextItem translation = translations.FirstOrDefault(); + + Console.WriteLine($"Source Text: {translation.SourceText.Text}"); + Console.WriteLine($"Translation: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + Console.WriteLine($"Transliterated text ({translation?.Translations?.FirstOrDefault()?.Transliteration?.Script}): {translation?.Translations?.FirstOrDefault()?.Transliteration?.Text}"); + } + catch (RequestFailedException exception) + { + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); + } + #endregion + } + [Test] public async void GetTranslationTextTransliteratedAsync() { @@ -1350,7 +1416,7 @@ public void FindTextSentenceSentenceBoundaries() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { @@ -1374,7 +1440,7 @@ public async void FindTextSentenceSentenceBoundariesAsync() BreakSentenceItem brokenSentence = brokenSentences.FirstOrDefault(); Console.WriteLine($"Detected languages of the input text: {brokenSentence?.DetectedLanguage?.Language} with score: {brokenSentence?.DetectedLanguage?.Score}."); - Console.WriteLine($"The detected sentece boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); + Console.WriteLine($"The detected sentence boundaries: '{string.Join(",", brokenSentence?.SentLen)}'."); } catch (RequestFailedException exception) { diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs index b1bb30aa76f91..d3329b2dadbc3 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs @@ -39,6 +39,23 @@ public async Task TranslateBasic() Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); } + [RecordedTest] + public async Task TranslateBasicOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.SourceLanguage = "es"; + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] {"Hola mundo" }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.AreEqual("cs", response.Value.FirstOrDefault().Translations.FirstOrDefault().To); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + } + [RecordedTest] public async Task TranslateWithAutoDetect() { @@ -55,6 +72,23 @@ public async Task TranslateWithAutoDetect() Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); } + [RecordedTest] + public async Task TranslateWithAutoDetectOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] { "This is a test." }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.AreEqual("cs", response.Value.FirstOrDefault().Translations.FirstOrDefault().To); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + } + [RecordedTest] public async Task TranslateWithNoTranslateTag() { @@ -70,6 +104,23 @@ public async Task TranslateWithNoTranslateTag() Assert.IsTrue(response.Value.FirstOrDefault().Translations.First().Text.Contains("今天是怎么回事是")); } + [RecordedTest] + public async Task TranslateWithNoTranslateTagOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.SourceLanguage = "zh-chs"; + options.TargetLanguages = new[] { "en" }; + options.Content = new[] { "今天是怎么回事是非常可怕的" }; + options.TextType = TextType.Html; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.IsTrue(response.Value.FirstOrDefault().Translations.First().Text.Contains("今天是怎么回事是")); + } + [RecordedTest] public async Task TranslateWithDictionaryTag() { @@ -86,6 +137,23 @@ public async Task TranslateWithDictionaryTag() Assert.IsTrue(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text.Contains("wordomatic")); } + [RecordedTest] + public async Task TranslateWithDictionaryTagOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.SourceLanguage = "en"; + options.TargetLanguages = new[] { "es" }; + options.Content = new[] { "The word < mstrans:dictionary translation =\"wordomatic\">wordomatic is a dictionary entry." }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.AreEqual("es", response.Value.FirstOrDefault().Translations.FirstOrDefault().To); + Assert.IsTrue(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text.Contains("wordomatic")); + } + [RecordedTest] public async Task TranslateWithTransliteration() { @@ -102,6 +170,26 @@ public async Task TranslateWithTransliteration() Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); } + [RecordedTest] + public async Task TranslateWithTransliterationOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "zh-Hans" }; + options.Content = new[] { "hudha akhtabar." }; + options.SourceLanguage = "ar"; + options.FromScript = "Latn"; + options.ToScript = "Latn"; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + + Assert.NotNull(response.Value.FirstOrDefault().SourceText.Text); + Assert.AreEqual("zh-Hans", response.Value.FirstOrDefault().Translations.FirstOrDefault().To); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + } + [RecordedTest] public async Task TranslateFromLatinToLatinScript() { @@ -115,6 +203,23 @@ public async Task TranslateFromLatinToLatinScript() Assert.AreEqual("eppadi irukkiraai?", response.Value.FirstOrDefault().Translations.FirstOrDefault().Transliteration.Text); } + [RecordedTest] + public async Task TranslateFromLatinToLatinScriptOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "ta" }; + options.Content = new[] { "ap kaise ho" }; + options.SourceLanguage = "hi"; + options.FromScript = "Latn"; + options.ToScript = "Latn"; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Transliteration); + Assert.AreEqual("eppadi irukkiraai?", response.Value.FirstOrDefault().Translations.FirstOrDefault().Transliteration.Text); + } + [RecordedTest] public async Task TranslateWithMultipleInputTexts() { @@ -144,6 +249,36 @@ public async Task TranslateWithMultipleInputTexts() Assert.NotNull(response.Value[2].Translations.FirstOrDefault().Text); } + [RecordedTest] + public async Task TranslateWithMultipleInputTextsOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] + { + "This is a test.", + "Esto es una prueba.", + "Dies ist ein Test." + }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(3, response.Value.Count); + + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.AreEqual("es", response.Value[1].DetectedLanguage.Language); + Assert.AreEqual("de", response.Value[2].DetectedLanguage.Language); + + Assert.AreEqual(1, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + Assert.NotNull(response.Value[1].Translations.FirstOrDefault().Text); + Assert.NotNull(response.Value[2].Translations.FirstOrDefault().Text); + } + [RecordedTest] public async Task TranslateMultipleTargetLanguages() { @@ -164,6 +299,27 @@ public async Task TranslateMultipleTargetLanguages() Assert.NotNull(response.Value.FirstOrDefault().Translations[2].Text); } + [RecordedTest] + public async Task TranslateMultipleTargetLanguagesOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "cs", "es", "de" }; + options.Content = new[] { "This is a test." }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(3, response.Value.FirstOrDefault().Translations.Count); + + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + Assert.NotNull(response.Value.FirstOrDefault().Translations[1].Text); + Assert.NotNull(response.Value.FirstOrDefault().Translations[2].Text); + } + [RecordedTest] public async Task TranslateDifferentTextTypes() { @@ -180,6 +336,24 @@ public async Task TranslateDifferentTextTypes() Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); } + [RecordedTest] + public async Task TranslateDifferentTextTypesOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] { "This is a test." }; + options.TextType = TextType.Html; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + } + [RecordedTest] public async Task TranslateWithProfanity() { @@ -197,6 +371,26 @@ public async Task TranslateWithProfanity() Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); Assert.IsTrue(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text.Contains("***")); } + + [RecordedTest] + public async Task TranslateWithProfanityOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.ProfanityAction = ProfanityAction.Marked; + options.ProfanityMarker = ProfanityMarker.Asterisk; + options.TargetLanguages = new[] { "zh-cn" }; + options.Content = new[] { "shit this is fucking crazy" }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.IsTrue(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text.Contains("***")); + } + [RecordedTest] public async Task TranslateWithAlignment() { @@ -214,6 +408,23 @@ public async Task TranslateWithAlignment() Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Alignment.Proj); } + public async Task TranslateWithAlignmentOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.IncludeAlignment = true; + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] { "It is a beautiful morning" }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Alignment.Proj); + } + [RecordedTest] public async Task TranslateWithIncludeSentenceLength() { @@ -232,6 +443,25 @@ public async Task TranslateWithIncludeSentenceLength() Assert.AreEqual(3, response.Value.FirstOrDefault().Translations.FirstOrDefault().SentLen.TransSentLen.Count); } + [RecordedTest] + public async Task TranslateWithIncludeSentenceLengthOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.IncludeSentenceLength = true; + options.TargetLanguages = new[] { "fr" }; + options.Content = new[] { "La réponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adaptées à un site ou des utilisateurs comme un être humain. Il suffit de copier et coller un extrait de code n'importe où." }; + TextTranslationClient client = GetClient(); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual("fr", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.AreEqual(3, response.Value.FirstOrDefault().Translations.FirstOrDefault().SentLen.SrcSentLen.Count); + Assert.AreEqual(3, response.Value.FirstOrDefault().Translations.FirstOrDefault().SentLen.TransSentLen.Count); + } + [RecordedTest] public async Task TranslateWithCustomEndpoint() { @@ -248,6 +478,23 @@ public async Task TranslateWithCustomEndpoint() Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); } + [RecordedTest] + public async Task TranslateWithCustomEndpointOptions() + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.TargetLanguages = new[] { "cs" }; + options.Content = new[] { "It is a beautiful morning" }; + TextTranslationClient client = GetClient(endpoint: new Uri(TestEnvironment.CustomEndpoint)); + var response = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.AreEqual(1, response.Value.Count); + Assert.AreEqual("en", response.Value.FirstOrDefault().DetectedLanguage.Language); + Assert.LessOrEqual(0.5, response.Value.FirstOrDefault().DetectedLanguage.Score); + Assert.AreEqual(1, response.Value.FirstOrDefault().Translations.Count); + Assert.NotNull(response.Value.FirstOrDefault().Translations.FirstOrDefault().Text); + } + [RecordedTest] public async Task TranslateWithToken() { @@ -270,5 +517,30 @@ public async Task TranslateWithToken() Assert.AreEqual(200, translate.GetRawResponse().Status); Assert.AreEqual(1, translate.Value.Count); } + + [RecordedTest] + public async Task TranslateWithTokenOptions() + { + string accessToken; + if (Mode == RecordedTestMode.Playback) + { + accessToken = string.Empty; + } + else + { + accessToken = await GetAzureAuthorizationTokenAsync(); + } + + TokenCredential token = new StaticAccessTokenCredential(new AccessToken(accessToken, DateTimeOffset.Now.AddDays(1))); + + TextTranslationClient client = GetClient(token: token); + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); + options.Content = new[] { "This is a test." }; + options.TargetLanguages = new[] { "cs" }; + var translate = await client.TranslateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, translate.GetRawResponse().Status); + Assert.AreEqual(1, translate.Value.Count); + } } } diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs b/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs index bf513695fc0ca..2160a9956c7b3 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs @@ -32,6 +32,21 @@ public async Task VerifyTransliterationTest() Assert.AreEqual(200, response.GetRawResponse().Status); } + [RecordedTest] + public async Task VerifyTransliterationTestOptions() + { + TextTranslationClient client = GetClient(); + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); + options.Content = new[] { "这里怎么一回事?" }; + options.Language = "zh-Hans"; + options.FromScript = "Hans"; + options.ToScript = "Latn"; + + Response> response = + await client.TransliterateAsync(options).ConfigureAwait(false); + Assert.AreEqual(200, response.GetRawResponse().Status); + } + [RecordedTest] public async Task VerifyTransliterationWithMultipleTextArray() { @@ -48,6 +63,26 @@ public async Task VerifyTransliterationWithMultipleTextArray() Assert.IsFalse(string.IsNullOrEmpty(response.Value[1].Text)); } + [RecordedTest] + public async Task VerifyTransliterationWithMultipleTextArrayOptions() + { + TextTranslationClient client = GetClient(); + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); + options.Language = "hi"; + options.FromScript = "Deva"; + options.ToScript = "Latn"; + options.Content = new[] + { + "यहएककसौटीहैयहएककसौटीहै", + "यहएककसौटीहै" + }; + Response> response = await client.TransliterateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.IsFalse(string.IsNullOrEmpty(response.Value[0].Text)); + Assert.IsFalse(string.IsNullOrEmpty(response.Value[1].Text)); + } + [RecordedTest] public async Task VerifyTransliterationWithEditDistance() { @@ -75,5 +110,38 @@ public async Task VerifyTransliterationWithEditDistance() } Assert.IsTrue(editDistance < 6, $"Total string distance: {editDistance}"); } + + [RecordedTest] + public async Task VerifyTransliterationWithEditDistanceOptions() + { + TextTranslationClient client = GetClient(); + + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); + options.Language = "gu"; + options.FromScript = "latn"; + options.ToScript = "gujr"; + options.Content = new[] + { + "gujarat", + "hadman", + "hukkabar" + }; + Response> response = await client.TransliterateAsync(options).ConfigureAwait(false); + + Assert.AreEqual(200, response.GetRawResponse().Status); + Assert.IsFalse(string.IsNullOrEmpty(response.Value[0].Text)); + Assert.IsFalse(string.IsNullOrEmpty(response.Value[1].Text)); + Assert.IsFalse(string.IsNullOrEmpty(response.Value[2].Text)); + + List expectedText = new() + { "ગુજરાત", "હદમાં", "હુક્કાબાર" }; + + int editDistance = 0; + for (int i = 0; i < expectedText.Count; i++) + { + editDistance = editDistance + TestHelper.EditDistance(expectedText[i], response.Value[i].Text); + } + Assert.IsTrue(editDistance < 6, $"Total string distance: {editDistance}"); + } } } From 6a5a4dca33cb01540527a1f31c2e975b8607117e Mon Sep 17 00:00:00 2001 From: Rango Meadows Date: Fri, 22 Sep 2023 12:45:33 -0700 Subject: [PATCH 2/4] Remove empty options constructor, add new samples and recorded tests, update documentation. --- .../Azure.AI.Translation.Text/README.md | 56 ++++--- ...zure.AI.Translation.Text.netstandard2.0.cs | 34 +++++ .../samples/Sample2_Translate.md | 31 ++-- .../samples/Sample3_Transliterate.md | 13 +- .../Custom/TextTranslationTranslateOptions.cs | 43 ++++-- .../TextTranslationTransliterateOptions.cs | 39 +++-- .../Samples/Samples_TextTranslationClient.cs | 6 - .../tests/Samples/SampleSnippets.cs | 116 +++++++++++++-- .../TranslationLiveTests/TranslateBasic.json | 42 ++++++ .../TranslateBasicAsync.json | 42 ++++++ .../TranslateDifferentTextTypes.json | 42 ++++++ .../TranslateDifferentTextTypesAsync.json | 42 ++++++ .../TranslateFromLatinToLatinScript.json | 42 ++++++ .../TranslateFromLatinToLatinScriptAsync.json | 42 ++++++ .../TranslateMultipleTargetLanguages.json | 42 ++++++ ...TranslateMultipleTargetLanguagesAsync.json | 42 ++++++ .../TranslateWithAlignment.json | 42 ++++++ .../TranslateWithAlignmentAsync.json | 42 ++++++ .../TranslateWithAutoDetect.json | 42 ++++++ .../TranslateWithAutoDetectAsync.json | 42 ++++++ .../TranslateWithCustomEndpoint.json | 41 ++++++ .../TranslateWithCustomEndpointAsync.json | 41 ++++++ .../TranslateWithDictionaryTag.json | 42 ++++++ .../TranslateWithDictionaryTagAsync.json | 42 ++++++ .../TranslateWithIncludeSentenceLength.json | 42 ++++++ ...anslateWithIncludeSentenceLengthAsync.json | 42 ++++++ .../TranslateWithMultipleInputTexts.json | 42 ++++++ .../TranslateWithMultipleInputTextsAsync.json | 42 ++++++ .../TranslateWithNoTranslateTag.json | 42 ++++++ .../TranslateWithNoTranslateTagAsync.json | 42 ++++++ .../TranslateWithProfanity.json | 42 ++++++ .../TranslateWithProfanityAsync.json | 42 ++++++ .../TranslateWithToken.json | 41 ++++++ .../TranslateWithTokenAsync.json | 41 ++++++ .../TranslateWithTransliteration.json | 42 ++++++ .../TranslateWithTransliterationAsync.json | 42 ++++++ .../VerifyTransliterationTest.json | 41 ++++++ .../VerifyTransliterationTestAsync.json | 41 ++++++ ...VerifyTransliterationWithEditDistance.json | 41 ++++++ ...yTransliterationWithEditDistanceAsync.json | 41 ++++++ ...yTransliterationWithMultipleTextArray.json | 41 ++++++ ...sliterationWithMultipleTextArrayAsync.json | 41 ++++++ .../tests/TranslationLiveTests.cs | 139 ++++++++++-------- .../tests/TransliterationLiveTests.cs | 52 +++---- 44 files changed, 1779 insertions(+), 168 deletions(-) create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json create mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json diff --git a/sdk/translation/Azure.AI.Translation.Text/README.md b/sdk/translation/Azure.AI.Translation.Text/README.md index 50c2bccd4e2eb..ce5452788ee54 100644 --- a/sdk/translation/Azure.AI.Translation.Text/README.md +++ b/sdk/translation/Azure.AI.Translation.Text/README.md @@ -123,8 +123,7 @@ For samples on using the `languages` endpoint refer to more samples [here][langu Please refer to the service documentation for a conceptual discussion of [languages][languages_doc]. ### Translate - -Renders single source-language text to multiple target-language texts with a single request. +The simplest use of the Translate method is to invoke it with a single target language and one input string. ```C# Snippet:GetTextTranslation try @@ -146,21 +145,45 @@ catch (RequestFailedException exception) } ``` -A convenience overload of Translate is provided using a single TextTranslationTranslateOptions parameter. This sample demonstrates Translation and Transliteration in a single call using the options parameter. +A convenience overload of Translate is provided using a TextTranslationTranslateOptions parameter. This sample demonstrates rendering a single source-language to multiple target languages with a single request using the options overload. + +```C# Snippet:GetTextTranslationMatrixOptions +try +{ + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs", "es", "de" }, + content: new[] { "This is a test." } + ); + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + + foreach (TranslatedTextItem translation in translations) + { + Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); + + Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + } +} +catch (RequestFailedException exception) +{ + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); +} +``` + +This sample demonstrates Translation and Transliteration in a single call using the TextTranslationTranslateOptions parameter. Required parameters are passed to the constructor, optional parameters are set using an object initializer. ```C# Snippet:GetTranslationTextTransliteratedOptions try { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "zh-Hans", + content: "hudha akhtabar.") { FromScript = "Latn", SourceLanguage = "ar", - ToScript = "Latn", - TargetLanguages = new[] { "zh-Hans" }, - Content = new[] - { - "hudha akhtabar." - } + ToScript = "Latn" }; Response> response = client.Translate(options); @@ -213,13 +236,12 @@ A convenience overload of Transliterate is provided using a single TextTranslati ```C# Snippet:GetTransliteratedTextOptions try { - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() - { - Language = "zh-Hans", - FromScript = "Hans", - ToScript = "Latn", - Content = new[] { "这是个测试。" } - }; + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "zh-Hans", + fromScript: "Hans", + toScript: "Latn", + content: "这是个测试。" + ); Response> response = client.Transliterate(options); IReadOnlyList transliterations = response.Value; diff --git a/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs b/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs index 67bc13edc30a4..907eb99bd20c5 100644 --- a/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs +++ b/sdk/translation/Azure.AI.Translation.Text/api/Azure.AI.Translation.Text.netstandard2.0.cs @@ -196,14 +196,18 @@ protected TextTranslationClient(System.Uri endpoint, Azure.AI.Translation.Text.T public virtual Azure.Response> LookupDictionaryExamples(string from, string to, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, Azure.AI.Translation.Text.InputTextWithTranslation content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> LookupDictionaryExamplesAsync(string from, string to, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> Translate(Azure.AI.Translation.Text.TextTranslationTranslateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(string targetLanguage, System.Collections.Generic.IEnumerable content, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Translate(string targetLanguage, string text, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> TranslateAsync(Azure.AI.Translation.Text.TextTranslationTranslateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(string targetLanguage, System.Collections.Generic.IEnumerable content, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TranslateAsync(string targetLanguage, string text, string sourceLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> Transliterate(Azure.AI.Translation.Text.TextTranslationTransliterateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Transliterate(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response> Transliterate(string language, string fromScript, string toScript, string text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> TransliterateAsync(Azure.AI.Translation.Text.TextTranslationTransliterateOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TransliterateAsync(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task>> TransliterateAsync(string language, string fromScript, string toScript, string text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -215,6 +219,36 @@ public enum ServiceVersion V3_0 = 1, } } + public partial class TextTranslationTranslateOptions + { + public TextTranslationTranslateOptions(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content) { } + public TextTranslationTranslateOptions(System.Collections.Generic.IEnumerable targetLanguages, System.Collections.Generic.IEnumerable content, string clientTraceId = null, string sourceLanguage = null, Azure.AI.Translation.Text.TextType? textType = default(Azure.AI.Translation.Text.TextType?), string category = null, Azure.AI.Translation.Text.ProfanityAction? profanityAction = default(Azure.AI.Translation.Text.ProfanityAction?), Azure.AI.Translation.Text.ProfanityMarker? profanityMarker = default(Azure.AI.Translation.Text.ProfanityMarker?), bool? includeAlignment = default(bool?), bool? includeSentenceLength = default(bool?), string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = default(bool?)) { } + public TextTranslationTranslateOptions(string targetLanguage, string content) { } + public bool? AllowFallback { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public string ClientTraceId { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable Content { get { throw null; } } + public string FromScript { get { throw null; } set { } } + public bool? IncludeAlignment { get { throw null; } set { } } + public bool? IncludeSentenceLength { get { throw null; } set { } } + public Azure.AI.Translation.Text.ProfanityAction? ProfanityAction { get { throw null; } set { } } + public Azure.AI.Translation.Text.ProfanityMarker? ProfanityMarker { get { throw null; } set { } } + public string SourceLanguage { get { throw null; } set { } } + public string SuggestedFrom { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable TargetLanguages { get { throw null; } } + public Azure.AI.Translation.Text.TextType? TextType { get { throw null; } set { } } + public string ToScript { get { throw null; } set { } } + } + public partial class TextTranslationTransliterateOptions + { + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, System.Collections.Generic.IEnumerable content, string clientTraceId = null) { } + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, string clientTraceId = null) { } + public string ClientTraceId { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable Content { get { throw null; } } + public string FromScript { get { throw null; } } + public string Language { get { throw null; } } + public string ToScript { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct TextType : System.IEquatable { diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md index 5b5c8b124c7a2..5578798ef6dd8 100644 --- a/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md +++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample2_Translate.md @@ -90,16 +90,13 @@ A convenience overload of Translate is provided using a single TextTranslationTr ```C# Snippet:GetTranslationTextTransliteratedOptions try { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "zh-Hans", + content: "hudha akhtabar.") { FromScript = "Latn", SourceLanguage = "ar", - ToScript = "Latn", - TargetLanguages = new[] { "zh-Hans" }, - Content = new[] - { - "hudha akhtabar." - } + ToScript = "Latn" }; Response> response = client.Translate(options); @@ -121,18 +118,20 @@ catch (RequestFailedException exception) You can translate multiple text elements. Each input element can be in different language (source language parameter needs to be omitted and language auto-detection is used). Refer to [Request limits for Translator](https://learn.microsoft.com/azure/cognitive-services/translator/request-limits) for current limits. -```C# Snippet:GetMultipleTextTranslations +```C# Snippet:GetMultipleTextTranslationsOptions try { - IEnumerable targetLanguages = new[] { "cs" }; - IEnumerable inputTextElements = new[] - { - "This is a test.", - "Esto es una prueba.", - "Dies ist ein Test." - }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs" }, + content: new[] + { + "This is a test.", + "Esto es una prueba.", + "Dies ist ein Test." + } + ); - Response> response = client.Translate(targetLanguages, inputTextElements); + Response> response = client.Translate(options); IReadOnlyList translations = response.Value; foreach (TranslatedTextItem translation in translations) diff --git a/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md index a8427788bfff6..caddf546918ac 100644 --- a/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md +++ b/sdk/translation/Azure.AI.Translation.Text/samples/Sample3_Transliterate.md @@ -33,13 +33,12 @@ A convenience overload of Transliterate is provided using a single TextTranslati ```C# Snippet:GetTransliteratedTextOptions try { - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() - { - Language = "zh-Hans", - FromScript = "Hans", - ToScript = "Latn", - Content = new[] { "这是个测试。" } - }; + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "zh-Hans", + fromScript: "Hans", + toScript: "Latn", + content: "这是个测试。" + ); Response> response = client.Transliterate(options); IReadOnlyList transliterations = response.Value; diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs index 7c3aa531bcd10..2e59728665b20 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTranslateOptions.cs @@ -7,26 +7,26 @@ namespace Azure.AI.Translation.Text { /// Client options for TextTranslationClient.Translate - public partial class TextTranslationTranslateOptions : ClientOptions + public partial class TextTranslationTranslateOptions { /// /// 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. + /// It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. /// For example, use to=de and to=it to translate to German and Italian. /// - public IEnumerable TargetLanguages { get; set; } + public IEnumerable TargetLanguages { get; } /// /// Array of the text to be translated. /// - public IEnumerable Content { get; set; } + public IEnumerable Content { get; } /// /// A client-generated GUID to uniquely identify the request. /// public string ClientTraceId { get; set; } /// /// 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, + /// 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. @@ -65,7 +65,7 @@ public partial class TextTranslationTranslateOptions : ClientOptions /// public bool? IncludeSentenceLength { get; set; } /// - /// Specifies a fallback language if the language of the input text can't be identified. + /// 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. /// @@ -86,13 +86,38 @@ public partial class TextTranslationTranslateOptions : ClientOptions /// 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. + /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. /// public bool? AllowFallback { get; set; } /// Initializes new instance of TextTranslationTranslateOptions. - public TextTranslationTranslateOptions(): base() + /// + /// 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. + /// + /// Array of the text to be translated. + public TextTranslationTranslateOptions(IEnumerable targetLanguages, IEnumerable content) + { + Argument.AssertNotNull(targetLanguages, nameof(targetLanguages)); + Argument.AssertNotNull(content, nameof(content)); + TargetLanguages = targetLanguages; + Content = content; + } + + /// Initializes new instance of TextTranslationTranslateOptions. + /// + /// 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. + /// + /// Text to be translated. + public TextTranslationTranslateOptions(string targetLanguage, string content) { + Argument.AssertNotNullOrWhiteSpace(targetLanguage, nameof(targetLanguage)); + Argument.AssertNotNullOrWhiteSpace(content, nameof(content)); + TargetLanguages = new[] { targetLanguage }; + Content = new[] { content }; } /// Initializes new instance of TextTranslationTranslateOptions. @@ -152,7 +177,7 @@ public TextTranslationTranslateOptions(): base() /// 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. + /// specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. /// public TextTranslationTranslateOptions(IEnumerable targetLanguages, IEnumerable content, string clientTraceId = null, string sourceLanguage = null, TextType? textType = null, string category = null, ProfanityAction? profanityAction = null, ProfanityMarker? profanityMarker = null, bool? includeAlignment = null, bool? includeSentenceLength = null, string suggestedFrom = null, string fromScript = null, string toScript = null, bool? allowFallback = null): base() { diff --git a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs index a039304952757..a1e7b57853bb2 100644 --- a/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs +++ b/sdk/translation/Azure.AI.Translation.Text/src/Custom/TextTranslationTransliterateOptions.cs @@ -7,36 +7,56 @@ namespace Azure.AI.Translation.Text { /// Client options for TextTranslationClient.Transliterate - public partial class TextTranslationTransliterateOptions : ClientOptions + public partial class TextTranslationTransliterateOptions { /// /// 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. /// - public string Language { get; set; } + public string Language { get; } /// /// 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. /// - public string FromScript { get; set; } + public string FromScript { get; } /// /// 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. /// - public string ToScript { get; set; } + public string ToScript { get; } /// /// Array of the text to be transliterated. /// - public IEnumerable Content { get; set; } + public IEnumerable Content { get; } /// /// A client-generated GUID to uniquely identify the request. /// public string ClientTraceId { get; set; } /// Initializes new instance of TextTranslationTransliterateOptions. - public TextTranslationTransliterateOptions(): base() + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// 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. + /// + /// Array of the text to be transliterated. + /// A client-generated GUID to uniquely identify the request. + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null): base() { + Language = language; + FromScript = fromScript; + ToScript = toScript; + Content = content; + ClientTraceId = clientTraceId; } /// Initializes new instance of TextTranslationTransliterateOptions. @@ -53,15 +73,14 @@ public TextTranslationTransliterateOptions(): base() /// 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. /// - /// Array of the text to be transliterated. + /// The text to be transliterated. /// A client-generated GUID to uniquely identify the request. - public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, IEnumerable content, string clientTraceId = null): base() + public TextTranslationTransliterateOptions(string language, string fromScript, string toScript, string content, string clientTraceId = null) { Language = language; - Content = content; FromScript = fromScript; ToScript = toScript; - Content = content; + Content = new[] { content }; ClientTraceId = clientTraceId; } } diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs b/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs index 403084b6e93dd..597827a76267c 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/Generated/Samples/Samples_TextTranslationClient.cs @@ -5,12 +5,6 @@ #nullable disable -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using Azure; -using Azure.Core; using Azure.Identity; namespace Azure.AI.Translation.Text.Samples diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs b/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs index 9d1feb1a6e7bd..3f05e87edf15b 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/Samples/SampleSnippets.cs @@ -437,6 +437,32 @@ public void GetTextTranslation() #endregion } + [Test] + public void GetTextTranslationOptions() + { + TextTranslationClient client = CreateTextTranslationClient(); + + try + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "cs", + content: "This is a test." + ); + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + TranslatedTextItem translation = translations.FirstOrDefault(); + + Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); + Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + } + catch (RequestFailedException exception) + { + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); + } + } + [Test] public async void GetTextTranslationAsync() { @@ -568,7 +594,6 @@ public void GetMultipleTextTranslations() { TextTranslationClient client = CreateTextTranslationClient(); - #region Snippet:GetMultipleTextTranslations try { IEnumerable targetLanguages = new[] { "cs" }; @@ -593,6 +618,40 @@ public void GetMultipleTextTranslations() Console.WriteLine($"Error Code: {exception.ErrorCode}"); Console.WriteLine($"Message: {exception.Message}"); } + } + + [Test] + public void GetMultipleTextTranslationsOptions() + { + TextTranslationClient client = CreateTextTranslationClient(); + + #region Snippet:GetMultipleTextTranslationsOptions + try + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs" }, + content: new[] + { + "This is a test.", + "Esto es una prueba.", + "Dies ist ein Test." + } + ); + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + + foreach (TranslatedTextItem translation in translations) + { + Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); + Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + } + } + catch (RequestFailedException exception) + { + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); + } #endregion } @@ -659,6 +718,37 @@ public void GetTextTranslationMatrix() #endregion } + [Test] + public void GetTextTranslationMatrixOptions() + { + TextTranslationClient client = CreateTextTranslationClient(); + + #region Snippet:GetTextTranslationMatrixOptions + try + { + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs", "es", "de" }, + content: new[] { "This is a test." } + ); + + Response> response = client.Translate(options); + IReadOnlyList translations = response.Value; + + foreach (TranslatedTextItem translation in translations) + { + Console.WriteLine($"Detected languages of the input text: {translation?.DetectedLanguage?.Language} with score: {translation?.DetectedLanguage?.Score}."); + + Console.WriteLine($"Text was translated to: '{translation?.Translations?.FirstOrDefault().To}' and the result is: '{translation?.Translations?.FirstOrDefault()?.Text}'."); + } + } + catch (RequestFailedException exception) + { + Console.WriteLine($"Error Code: {exception.ErrorCode}"); + Console.WriteLine($"Message: {exception.Message}"); + } + #endregion + } + [Test] public async void GetTextTranslationMatrixAsync() { @@ -1253,13 +1343,12 @@ public void GetTransliteratedTextOptions() #region Snippet:GetTransliteratedTextOptions try { - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions() - { - Language = "zh-Hans", - FromScript = "Hans", - ToScript = "Latn", - Content = new[] { "这是个测试。" } - }; + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "zh-Hans", + fromScript: "Hans", + toScript: "Latn", + content: "这是个测试。" + ); Response> response = client.Transliterate(options); IReadOnlyList transliterations = response.Value; @@ -1342,16 +1431,13 @@ public void GetTranslationTextTransliteratedOptions() #region Snippet:GetTranslationTextTransliteratedOptions try { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions() + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "zh-Hans", + content: "hudha akhtabar.") { FromScript = "Latn", SourceLanguage = "ar", - ToScript = "Latn", - TargetLanguages = new[] { "zh-Hans" }, - Content = new[] - { - "hudha akhtabar." - } + ToScript = "Latn" }; Response> response = client.Translate(options); diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json new file mode 100644 index 0000000000000..2279e56f50937 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026from=es\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "23", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-f8548d4155047ef17dccde7b35953f8b-d366729a1d3e05aa-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "89ffef94966c342ca4f469c2bc4a8645", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022Hola mundo\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "53", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:13 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "10", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086DE" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022Ahoj sv\u011Bte\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "246203941", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json new file mode 100644 index 0000000000000..4248913ab2150 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026from=es\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "23", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-0944fe4f2cfdfd714cdd260a52720453-343753002a75bd6c-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "9b062b6f1135dbc76e3a53d2089f6504", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022Hola mundo\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "53", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "10", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08844" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022Ahoj sv\u011Bte\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "54674655", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json new file mode 100644 index 0000000000000..b1b29f45da67a --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026textType=Html\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "121", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-b56aad3bda30a2095eb5c35b84d2777d-4139c48c95ad75a2-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "7eb90ee2fef690240b1a6960f7374a15", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u003Chtml\\u003E\\u003Cbody\\u003EThis \\u003Cb\\u003Eis\\u003C/b\\u003E a test.\\u003C/body\\u003E\\u003C/html\\u003E\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "137", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "48", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086E7" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Chtml\u003E\u003Cbody\u003EToto \u003Cb\u003Eje\u003C/b\u003E test.\u003C/body\u003E\u003C/html\u003E\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "818479780", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json new file mode 100644 index 0000000000000..de7740f92ee77 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026textType=Html\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "121", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-ce8e4f5b27ba87efee393d659d2d7a1b-06b4766a9d8800cd-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "6559b6e16715e83ff3e97bbd3f92d5bc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u003Chtml\\u003E\\u003Cbody\\u003EThis \\u003Cb\\u003Eis\\u003C/b\\u003E a test.\\u003C/body\\u003E\\u003C/html\\u003E\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "137", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "48", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08850" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Chtml\u003E\u003Cbody\u003EToto \u003Cb\u003Eje\u003C/b\u003E test.\u003C/body\u003E\u003C/html\u003E\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "10406007", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json new file mode 100644 index 0000000000000..6dc3e6a924a8e --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=ta\u0026from=hi\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "24", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-13bb5ea80bb135cd6c91a7dbe8f5434c-9f2b91a6bbf86b31-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "f316a320bd85c32262ac22b2728ad814", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022ap kaise ho\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "213", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "11", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086F6" + }, + "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u090F\u092A\u0940 \u0915\u0948\u0938\u0947 \u0939\u094B\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u0B8E\u0BAA\u0BCD\u0BAA\u0B9F\u0BBF \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95\u0BBF\u0BB1\u0BBE\u0BAF\u0BCD?\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022eppadi irukkiraai?\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022ta\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "885938075", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json new file mode 100644 index 0000000000000..09517c4a4ec45 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=ta\u0026from=hi\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "24", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-17517502863baa063d80a394b0d6b8e3-97de4d9f355afe48-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "b2b6f1327bd1aaec466f2bb3946c1a9e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022ap kaise ho\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "213", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "11", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08857" + }, + "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u090F\u092A\u0940 \u0915\u0948\u0938\u0947 \u0939\u094B\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u0B8E\u0BAA\u0BCD\u0BAA\u0B9F\u0BBF \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95\u0BBF\u0BB1\u0BBE\u0BAF\u0BCD?\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022eppadi irukkiraai?\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022ta\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "347530639", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json new file mode 100644 index 0000000000000..f5d6579bbf4df --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026to=es\u0026to=de\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-00a448cdac3c54c26789f9e33928af89-57d9d6d183f4486d-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "be49b184c5e871028269011e2409b40f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "186", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "45", + "X-MT-System": "Microsoft,Microsoft,Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08705" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022,\u0022to\u0022:\u0022es\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022,\u0022to\u0022:\u0022de\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1643775044", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json new file mode 100644 index 0000000000000..33d410713f4a6 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026to=es\u0026to=de\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-e0210babe96dd761fb4c0f368169bcc8-1a1d9fb66c40d064-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "65ed456c2349ba2c8b19c011ade81e6d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "186", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "45", + "X-MT-System": "Microsoft,Microsoft,Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08862" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022,\u0022to\u0022:\u0022es\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022,\u0022to\u0022:\u0022de\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1164865256", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json new file mode 100644 index 0000000000000..af3e9d983076a --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026includeAlignment=true\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "38", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-aae403e063c54afaac9c8931920cf3f2-5080c59cc11f68ba-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "f3d5b9a935ec3d00f1626a8a80685a5d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "159", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "25", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08712" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022,\u0022alignment\u0022:{\u0022proj\u0022:\u00220:1-0:1 0:1-3:8 18:24-10:13\u0022}}]}]" + } + ], + "Variables": { + "RandomSeed": "883133905", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json new file mode 100644 index 0000000000000..508322f44c090 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026includeAlignment=true\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "38", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-189f932a408e56ace522754218bcbd25-20d9addf2bb6a29a-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "dc2f3bd29e53c76e95c9a6172516982d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "159", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "25", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08870" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022,\u0022alignment\u0022:{\u0022proj\u0022:\u00220:1-0:1 0:1-3:8 18:24-10:13\u0022}}]}]" + } + ], + "Variables": { + "RandomSeed": "1691118378", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json new file mode 100644 index 0000000000000..22e496c37e89b --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-215ad245e04776b589537fbe85c52937-5c8da5e0888e1ae3-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "8469fa1caedea43fd81dbba9791cc375", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "105", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08721" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "742269699", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json new file mode 100644 index 0000000000000..def66a683fe75 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-2d89035fee0af5c9e6b1053f1fe968d4-807fc44acac65f20-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "311dedc37d498cae67af36ef6568e4d2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "105", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0887A" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "2085760073", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json new file mode 100644 index 0000000000000..fc4a24aa85d98 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com/translator/text/v3.0/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "38", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-c488101bbcf26f269cd34493e34c97cf-9d2a97877ed58006-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "32e7657a076e21af2fd25721b10fac00", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-RequestId,X-Metered-Usage", + "apim-request-id": "55117335-419b-44a7-a56f-116aad874733", + "Content-Length": "108", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "25", + "x-ms-region": "West US", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0875E" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "130081400", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_CUSTOM_ENDPOINT": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json new file mode 100644 index 0000000000000..a5d8009f3ad17 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com/translator/text/v3.0/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "38", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-530c82e3ba0b027c7b285b69dbc88e75-e12f6d34057126f1-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "a604cede46a31759fbbec085b8958fba", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": "X-RequestId,X-Metered-Usage", + "apim-request-id": "836d84f4-0786-417b-a3bd-abe709297ac6", + "Content-Length": "108", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "25", + "x-ms-region": "West US", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0888F" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "527291978", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_CUSTOM_ENDPOINT": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json new file mode 100644 index 0000000000000..900869e6a0865 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=es\u0026from=en\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "153", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-6909de961e03f15e537150ba30b7b17b-474eef040a2eff45-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "2b31619dbebd87ba0bca89440b30aa6d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022The word \\u003C mstrans:dictionary translation =\\u0022wordomatic\\u0022\\u003Ewordomatic\\u003C/mstrans:dictionary\\u003E is a dictionary entry.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "164", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "110", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08780" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022La palabra \u003C mstrans:dictionary translation =\\\u0022wordomatic\\\u0022\u003Ewordomatic\u003C/mstrans:dictionary\u003E es una entrada de diccionario.\u0022,\u0022to\u0022:\u0022es\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "925755453", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json new file mode 100644 index 0000000000000..0c9ed67a905bf --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=es\u0026from=en\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "153", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-6bc7b8f09bd822ec404d81ce10386b83-1b4e67d4ebdaa71a-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "5afa96d4a8d1eff30420c7832bdbaa1e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022The word \\u003C mstrans:dictionary translation =\\u0022wordomatic\\u0022\\u003Ewordomatic\\u003C/mstrans:dictionary\\u003E is a dictionary entry.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "164", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "110", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088C2" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022La palabra \u003C mstrans:dictionary translation =\\\u0022wordomatic\\\u0022\u003Ewordomatic\u003C/mstrans:dictionary\u003E es una entrada de diccionario.\u0022,\u0022to\u0022:\u0022es\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1852603014", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json new file mode 100644 index 0000000000000..94e151e02e2ad --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=fr\u0026includeSentenceLength=true\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "315", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-fdfc169513f638380285a0ff1b51f0bf-6ae20e4105ef9ed2-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "992e9dd85ea4bb7eaac46383d8fde4f7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022La r\\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\\u00E9es \\u00E0 un site ou des utilisateurs comme un \\u00EAtre humain. Il suffit de copier et coller un extrait de code n\\u0027importe o\\u00F9.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "432", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "272", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087A1" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022fr\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022La r\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\u00E9es \u00E0 un site ou des utilisateurs comme un \u00EAtre humain. Il suffit de copier et coller un extrait de code n\u0027importe o\u00F9.\u0022,\u0022to\u0022:\u0022fr\u0022,\u0022sentLen\u0022:{\u0022srcSentLen\u0022:[53,157,62],\u0022transSentLen\u0022:[53,157,62]}}]}]" + } + ], + "Variables": { + "RandomSeed": "1526704476", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json new file mode 100644 index 0000000000000..bcd919116d20f --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=fr\u0026includeSentenceLength=true\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "315", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-366e4b3757e9ffce6ea7961a3a82e821-b44c918190e6835a-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "91daf351d94dbb30975fd45fb4cb1537", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022La r\\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\\u00E9es \\u00E0 un site ou des utilisateurs comme un \\u00EAtre humain. Il suffit de copier et coller un extrait de code n\\u0027importe o\\u00F9.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "432", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "272", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088D5" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022fr\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022La r\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\u00E9es \u00E0 un site ou des utilisateurs comme un \u00EAtre humain. Il suffit de copier et coller un extrait de code n\u0027importe o\u00F9.\u0022,\u0022to\u0022:\u0022fr\u0022,\u0022sentLen\u0022:{\u0022srcSentLen\u0022:[53,157,62],\u0022transSentLen\u0022:[53,157,62]}}]}]" + } + ], + "Variables": { + "RandomSeed": "486864016", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json new file mode 100644 index 0000000000000..2293c1e5402a4 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "89", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-d89387673cd8124811c51a8145f9d075-5688bd1f880f10ac-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "af79da81ee7a8c9977a73c1c458c7378", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "313", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "52", + "X-MT-System": "Microsoft,Microsoft,Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087A8" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022es\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022de\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "896702095", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json new file mode 100644 index 0000000000000..f9f935e59b9f7 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "89", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-afbd31d7500ba1f0f6dfe04633d24ddf-8051c386196cfb01-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "ac9dcd88ecc3aa7e36525177d747f028", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "313", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "52", + "X-MT-System": "Microsoft,Microsoft,Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088E8" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022es\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022de\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1621916574", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json new file mode 100644 index 0000000000000..02274f3752255 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=en\u0026from=zh-chs\u0026textType=Html\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "142", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-71f7b5d3093272dd484632afa5161c2e-001ff05366f4f0f3-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "993ef21a66e45d2bb26836ece04794b6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u003Cspan class=notranslate\\u003E\\u4ECA\\u5929\\u662F\\u600E\\u4E48\\u56DE\\u4E8B\\u662F\\u003C/span\\u003E\\u975E\\u5E38\\u53EF\\u6015\\u7684\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "107", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "44", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087B2" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Cspan class=notranslate\u003E\u4ECA\u5929\u662F\u600E\u4E48\u56DE\u4E8B\u662F\u003C/span\u003Every scary\u0022,\u0022to\u0022:\u0022en\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1489171728", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json new file mode 100644 index 0000000000000..d797cb1528d34 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=en\u0026from=zh-chs\u0026textType=Html\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "142", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-23c6fa36d20826cfa73e09895f3c3ef2-cf667ca257118bff-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "bbb1be8178dbef83ceec9eab652d9469", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u003Cspan class=notranslate\\u003E\\u4ECA\\u5929\\u662F\\u600E\\u4E48\\u56DE\\u4E8B\\u662F\\u003C/span\\u003E\\u975E\\u5E38\\u53EF\\u6015\\u7684\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "107", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "44", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088F9" + }, + "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Cspan class=notranslate\u003E\u4ECA\u5929\u662F\u600E\u4E48\u56DE\u4E8B\u662F\u003C/span\u003Every scary\u0022,\u0022to\u0022:\u0022en\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1428461796", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json new file mode 100644 index 0000000000000..2ce9d4d845890 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-cn\u0026profanityAction=Marked\u0026profanityMarker=Asterisk\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "39", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-53b7a11e7da25d97f50d5795ca81e248-55ef21cfbc5268ad-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "ec3a1df4018aca220d224d82085cdd63", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022shit this is fucking crazy\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "123", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "26", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087CA" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u5988\u7684\uFF0C\u8FD9***\u592A\u75AF\u72C2\u4E86\u0022,\u0022to\u0022:\u0022zh-Hans\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1981466251", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json new file mode 100644 index 0000000000000..92d51545296e6 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-cn\u0026profanityAction=Marked\u0026profanityMarker=Asterisk\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "39", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-73218ef9289b3b05b041dab44cb42894-7ece4ab2066a01a8-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "9a69ad0f960f109a5c38e0faa5834044", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022shit this is fucking crazy\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "123", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "26", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08903" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u5988\u7684\uFF0C\u8FD9***\u592A\u75AF\u72C2\u4E86\u0022,\u0022to\u0022:\u0022zh-Hans\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1350797198", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json new file mode 100644 index 0000000000000..dc0c6ed3731d9 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "28", + "Content-Type": "application/json", + "traceparent": "00-ee41a750ebcb5646951503c49ef9ed86-0d109255d65f1a39-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "de8fc3c0e3b3927cf86e57b6cd188c43", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "105", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0882A" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "374192827", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json new file mode 100644 index 0000000000000..bfcbfa632ef35 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "28", + "Content-Type": "application/json", + "traceparent": "00-3fadcf2c149e6e42dcaaa65947386ce8-2325df1472eaf33b-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "db92b052d3c7d7c7b8c9db015c0c81bc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "105", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08926" + }, + "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "746316710", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json new file mode 100644 index 0000000000000..1f51318915d2f --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-Hans\u0026from=ar\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-fcaed6c5e4327aa25dd9f3ef180c8b70-22d7e7716fd912ad-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "229a12c93a8dbcfad666d2e2b3606eac", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022hudha akhtabar.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "179", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08833" + }, + "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631.\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u8FD9\u662F\u4E2A\u6D4B\u8BD5\u3002\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022zh\u00E8 sh\u00ECg\u00E8 c\u00E8sh\u00EC\u3002\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022zh-Hans\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "1721483215", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json new file mode 100644 index 0000000000000..cc85ac057b734 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json @@ -0,0 +1,42 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-Hans\u0026from=ar\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "28", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-f1a95372009300c3534db32e513024da-dc0c1446ef3c2dc9-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "00ab489d1ee08ed764cf544fca8a64c7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022hudha akhtabar.\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "179", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "15", + "X-MT-System": "Microsoft", + "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0892E" + }, + "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631.\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u8FD9\u662F\u4E2A\u6D4B\u8BD5\u3002\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022zh\u00E8 sh\u00ECg\u00E8 c\u00E8sh\u00EC\u3002\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022zh-Hans\u0022}]}]" + } + ], + "Variables": { + "RandomSeed": "408784969", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json new file mode 100644 index 0000000000000..fa9364efafe8a --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=zh-Hans\u0026fromScript=Hans\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "56", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-fdf9beb15cc5d71e24dac2910475fe9e-a38c1d007397156c-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "48a0486d0fb96d0f3826747f8b0bf1cf", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u8FD9\\u91CC\\u600E\\u4E48\\u4E00\\u56DE\\u4E8B?\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "56", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "8", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F08931" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022zh\u00E8l\u01D0 z\u011Bnme y\u00EChu\u00EDsh\u00EC?\u0022,\u0022script\u0022:\u0022Latn\u0022}]" + } + ], + "Variables": { + "RandomSeed": "1326958711", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json new file mode 100644 index 0000000000000..ecc120a2054d3 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=zh-Hans\u0026fromScript=Hans\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "56", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-f76c4370371d5372eaa6e0a103d47577-1141a1dd932ddcfa-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "348406db74bd909307f9996bd72d436a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u8FD9\\u91CC\\u600E\\u4E48\\u4E00\\u56DE\\u4E8B?\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "56", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "8", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0895B" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022zh\u00E8l\u01D0 z\u011Bnme y\u00EChu\u00EDsh\u00EC?\u0022,\u0022script\u0022:\u0022Latn\u0022}]" + } + ], + "Variables": { + "RandomSeed": "116707324", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json new file mode 100644 index 0000000000000..54c636bb1b979 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=gu\u0026fromScript=latn\u0026toScript=gujr\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "58", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-09a06d2508c7c14ce89b8e12dcc91a9a-067f89d3fbef2a0e-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "8bb4201d189aa076cfbb17fda8578b39", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022gujarat\u0022},{\u0022text\u0022:\u0022hadman\u0022},{\u0022text\u0022:\u0022hukkabar\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "148", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "21", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0893A" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC7\u0AA1\u0AAE\u0AC7\u0AA8\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC1\u0A95\u0ACD\u0A95\u0ABE\u0AAC\u0ABE\u0AB0\u0022,\u0022script\u0022:\u0022gujr\u0022}]" + } + ], + "Variables": { + "RandomSeed": "531091503", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json new file mode 100644 index 0000000000000..988dbdaa10660 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=gu\u0026fromScript=latn\u0026toScript=gujr\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "58", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-8ed457e2b0f7b6144a23c44373600655-9180f2b6fa088be7-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "7866674fdddcafe96246585a937b0300", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022gujarat\u0022},{\u0022text\u0022:\u0022hadman\u0022},{\u0022text\u0022:\u0022hukkabar\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "148", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "21", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0896A" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC7\u0AA1\u0AAE\u0AC7\u0AA8\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC1\u0A95\u0ACD\u0A95\u0ABE\u0AAC\u0ABE\u0AB0\u0022,\u0022script\u0022:\u0022gujr\u0022}]" + } + ], + "Variables": { + "RandomSeed": "1451694606", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json new file mode 100644 index 0000000000000..880ab5902fd7a --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=hi\u0026fromScript=Deva\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "223", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-d556cf200587daf1580ebce3d8fd6230-dcfd199e539c8a1f-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "6bd397b0b7a4a07dc8977e4a31ccc7fe", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022},{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "96", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "33", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F08949" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022yhekakasautihekasautihai\u0022,\u0022script\u0022:\u0022Latn\u0022},{\u0022text\u0022:\u0022yhekakasoutihai\u0022,\u0022script\u0022:\u0022Latn\u0022}]" + } + ], + "Variables": { + "RandomSeed": "44988461", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json new file mode 100644 index 0000000000000..66004a67aa298 --- /dev/null +++ b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json @@ -0,0 +1,41 @@ +{ + "Entries": [ + { + "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=hi\u0026fromScript=Deva\u0026toScript=Latn\u0026api-version=3.0", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "223", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "Ocp-Apim-Subscription-Region": "westus", + "traceparent": "00-bf118c6cb0c828b2a74bcd1eefb9baf9-50086dc8310e4628-00", + "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", + "x-ms-client-request-id": "e4ab4eebb19ee582de86498704a1b4a4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": "[{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022},{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022}]", + "StatusCode": 200, + "ResponseHeaders": { + "Access-Control-Expose-Headers": [ + "X-RequestId", + "X-Metered-Usage" + ], + "Content-Length": "96", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 03 Apr 2023 21:50:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Metered-Usage": "33", + "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0897C" + }, + "ResponseBody": "[{\u0022text\u0022:\u0022yhekakasautihekasautihai\u0022,\u0022script\u0022:\u0022Latn\u0022},{\u0022text\u0022:\u0022yhekakasoutihai\u0022,\u0022script\u0022:\u0022Latn\u0022}]" + } + ], + "Variables": { + "RandomSeed": "560855002", + "TEXT_TRANSLATION_API_KEY": "Sanitized", + "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", + "TEXT_TRANSLATION_REGION": "westus" + } +} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs index d3329b2dadbc3..35b51524cb19f 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs @@ -42,12 +42,13 @@ public async Task TranslateBasic() [RecordedTest] public async Task TranslateBasicOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.SourceLanguage = "es"; - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] {"Hola mundo" }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "cs", content: "Hola mundo") + { + SourceLanguage = "es", + }; TextTranslationClient client = GetClient(); - var response = await client.TranslateAsync(options).ConfigureAwait(false); + var response = await client.TranslateAsync( + options).ConfigureAwait(false); Assert.AreEqual(200, response.GetRawResponse().Status); Assert.AreEqual(1, response.Value.Count); @@ -75,9 +76,7 @@ public async Task TranslateWithAutoDetect() [RecordedTest] public async Task TranslateWithAutoDetectOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] { "This is a test." }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "cs", content: "This is a test."); TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -107,11 +106,11 @@ public async Task TranslateWithNoTranslateTag() [RecordedTest] public async Task TranslateWithNoTranslateTagOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.SourceLanguage = "zh-chs"; - options.TargetLanguages = new[] { "en" }; - options.Content = new[] { "今天是怎么回事是非常可怕的" }; - options.TextType = TextType.Html; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "en", content: "今天是怎么回事是非常可怕的") + { + SourceLanguage = "zh-chs", + TextType = TextType.Html + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -140,10 +139,10 @@ public async Task TranslateWithDictionaryTag() [RecordedTest] public async Task TranslateWithDictionaryTagOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.SourceLanguage = "en"; - options.TargetLanguages = new[] { "es" }; - options.Content = new[] { "The word < mstrans:dictionary translation =\"wordomatic\">wordomatic is a dictionary entry." }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "en", content: "The word < mstrans:dictionary translation =\"wordomatic\">wordomatic is a dictionary entry.") + { + SourceLanguage = "en" + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -173,12 +172,12 @@ public async Task TranslateWithTransliteration() [RecordedTest] public async Task TranslateWithTransliterationOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "zh-Hans" }; - options.Content = new[] { "hudha akhtabar." }; - options.SourceLanguage = "ar"; - options.FromScript = "Latn"; - options.ToScript = "Latn"; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "zh-Hans", content: "hudha akhtabar.") + { + SourceLanguage = "ar", + FromScript = "Latn", + ToScript = "Latn" + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -206,12 +205,14 @@ public async Task TranslateFromLatinToLatinScript() [RecordedTest] public async Task TranslateFromLatinToLatinScriptOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "ta" }; - options.Content = new[] { "ap kaise ho" }; - options.SourceLanguage = "hi"; - options.FromScript = "Latn"; - options.ToScript = "Latn"; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "ta", + content: "ap kaise ho") + { + SourceLanguage = "hi", + FromScript = "Latn", + ToScript = "Latn", + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -252,14 +253,15 @@ public async Task TranslateWithMultipleInputTexts() [RecordedTest] public async Task TranslateWithMultipleInputTextsOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] - { - "This is a test.", - "Esto es una prueba.", - "Dies ist ein Test." - }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs" }, + content: new[] + { + "This is a test.", + "Esto es una prueba.", + "Dies ist ein Test." + } + ); TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -302,9 +304,10 @@ public async Task TranslateMultipleTargetLanguages() [RecordedTest] public async Task TranslateMultipleTargetLanguagesOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "cs", "es", "de" }; - options.Content = new[] { "This is a test." }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs", "es", "de" }, + content: new[] { "This is a test." } + ); TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -339,10 +342,12 @@ public async Task TranslateDifferentTextTypes() [RecordedTest] public async Task TranslateDifferentTextTypesOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] { "This is a test." }; - options.TextType = TextType.Html; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguages: new[] { "cs" }, + content: new[] { "This is a test." }) + { + TextType = TextType.Html + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -375,11 +380,13 @@ public async Task TranslateWithProfanity() [RecordedTest] public async Task TranslateWithProfanityOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.ProfanityAction = ProfanityAction.Marked; - options.ProfanityMarker = ProfanityMarker.Asterisk; - options.TargetLanguages = new[] { "zh-cn" }; - options.Content = new[] { "shit this is fucking crazy" }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "zh-cn", + content: "shit this is fucking crazy") + { + ProfanityAction = ProfanityAction.Marked, + ProfanityMarker = ProfanityMarker.Asterisk, + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -410,10 +417,12 @@ public async Task TranslateWithAlignment() public async Task TranslateWithAlignmentOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.IncludeAlignment = true; - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] { "It is a beautiful morning" }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "cs", + content: "It is a beautiful morning") + { + IncludeAlignment = true, + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -446,10 +455,12 @@ public async Task TranslateWithIncludeSentenceLength() [RecordedTest] public async Task TranslateWithIncludeSentenceLengthOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.IncludeSentenceLength = true; - options.TargetLanguages = new[] { "fr" }; - options.Content = new[] { "La réponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adaptées à un site ou des utilisateurs comme un être humain. Il suffit de copier et coller un extrait de code n'importe où." }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "fr", + content: "La réponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adaptées à un site ou des utilisateurs comme un être humain. Il suffit de copier et coller un extrait de code n'importe où.") + { + IncludeSentenceLength = true + }; TextTranslationClient client = GetClient(); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -481,9 +492,10 @@ public async Task TranslateWithCustomEndpoint() [RecordedTest] public async Task TranslateWithCustomEndpointOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.TargetLanguages = new[] { "cs" }; - options.Content = new[] { "It is a beautiful morning" }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "cs", + content: "It is a beautiful morning" + ); TextTranslationClient client = GetClient(endpoint: new Uri(TestEnvironment.CustomEndpoint)); var response = await client.TranslateAsync(options).ConfigureAwait(false); @@ -534,9 +546,10 @@ public async Task TranslateWithTokenOptions() TokenCredential token = new StaticAccessTokenCredential(new AccessToken(accessToken, DateTimeOffset.Now.AddDays(1))); TextTranslationClient client = GetClient(token: token); - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(); - options.Content = new[] { "This is a test." }; - options.TargetLanguages = new[] { "cs" }; + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions( + targetLanguage: "cs", + content: "This is a test." + ); var translate = await client.TranslateAsync(options).ConfigureAwait(false); Assert.AreEqual(200, translate.GetRawResponse().Status); diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs b/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs index 2160a9956c7b3..5ebfe98132278 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/TransliterationLiveTests.cs @@ -36,12 +36,12 @@ public async Task VerifyTransliterationTest() public async Task VerifyTransliterationTestOptions() { TextTranslationClient client = GetClient(); - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); - options.Content = new[] { "这里怎么一回事?" }; - options.Language = "zh-Hans"; - options.FromScript = "Hans"; - options.ToScript = "Latn"; - + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "zh-Hans", + fromScript: "Hans", + toScript: "Latn", + content: new[] { "这里怎么一回事?" } + ); Response> response = await client.TransliterateAsync(options).ConfigureAwait(false); Assert.AreEqual(200, response.GetRawResponse().Status); @@ -67,15 +67,16 @@ public async Task VerifyTransliterationWithMultipleTextArray() public async Task VerifyTransliterationWithMultipleTextArrayOptions() { TextTranslationClient client = GetClient(); - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); - options.Language = "hi"; - options.FromScript = "Deva"; - options.ToScript = "Latn"; - options.Content = new[] - { - "यहएककसौटीहैयहएककसौटीहै", - "यहएककसौटीहै" - }; + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "hi", + fromScript: "Deva", + toScript: "Latn", + content: new[] + { + "यहएककसौटीहैयहएककसौटीहै", + "यहएककसौटीहै" + } + ); Response> response = await client.TransliterateAsync(options).ConfigureAwait(false); Assert.AreEqual(200, response.GetRawResponse().Status); @@ -116,16 +117,17 @@ public async Task VerifyTransliterationWithEditDistanceOptions() { TextTranslationClient client = GetClient(); - TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions(); - options.Language = "gu"; - options.FromScript = "latn"; - options.ToScript = "gujr"; - options.Content = new[] - { - "gujarat", - "hadman", - "hukkabar" - }; + TextTranslationTransliterateOptions options = new TextTranslationTransliterateOptions( + language: "gu", + fromScript: "latn", + toScript: "gujr", + content: new[] + { + "gujarat", + "hadman", + "hukkabar" + } + ); Response> response = await client.TransliterateAsync(options).ConfigureAwait(false); Assert.AreEqual(200, response.GetRawResponse().Status); From bd733dcae7372ad67b73030edfff30b57187fa8d Mon Sep 17 00:00:00 2001 From: Rango Meadows Date: Wed, 27 Sep 2023 15:07:05 -0700 Subject: [PATCH 3/4] Update CHANGELOG.md and assets.json, fixed bug in TranslationLiveTests.cs --- sdk/translation/Azure.AI.Translation.Text/CHANGELOG.md | 1 + sdk/translation/Azure.AI.Translation.Text/assets.json | 2 +- .../Azure.AI.Translation.Text/tests/TranslationLiveTests.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/translation/Azure.AI.Translation.Text/CHANGELOG.md b/sdk/translation/Azure.AI.Translation.Text/CHANGELOG.md index 3f012045f49d5..1eb8c6ed6629f 100644 --- a/sdk/translation/Azure.AI.Translation.Text/CHANGELOG.md +++ b/sdk/translation/Azure.AI.Translation.Text/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features Added - Introduced model factory `Azure.AI.Translation.Text.TextTranslationModelFactory` for mocking. +- Added options overloads to Translate and Transliterate. TextTranslationTranslateOptions and TextTranslationTransliterateOptions roll up method parameters into a single object. ### Breaking Changes diff --git a/sdk/translation/Azure.AI.Translation.Text/assets.json b/sdk/translation/Azure.AI.Translation.Text/assets.json index 17c231b90195d..0db91e5c1edd0 100644 --- a/sdk/translation/Azure.AI.Translation.Text/assets.json +++ b/sdk/translation/Azure.AI.Translation.Text/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/translation/Azure.AI.Translation.Text", - "Tag": "net/translation/Azure.AI.Translation.Text_311c195b9c" + "Tag": "net/translation/Azure.AI.Translation.Text_9702e6ff9b" } diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs index 35b51524cb19f..a07086322de5b 100644 --- a/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs +++ b/sdk/translation/Azure.AI.Translation.Text/tests/TranslationLiveTests.cs @@ -139,7 +139,7 @@ public async Task TranslateWithDictionaryTag() [RecordedTest] public async Task TranslateWithDictionaryTagOptions() { - TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "en", content: "The word < mstrans:dictionary translation =\"wordomatic\">wordomatic is a dictionary entry.") + TextTranslationTranslateOptions options = new TextTranslationTranslateOptions(targetLanguage: "es", content: "The word < mstrans:dictionary translation =\"wordomatic\">wordomatic is a dictionary entry.") { SourceLanguage = "en" }; From 1c4e93c2c64baa874b7ffb2bacdf532da90ed69b Mon Sep 17 00:00:00 2001 From: Rango Meadows Date: Wed, 27 Sep 2023 18:11:15 -0700 Subject: [PATCH 4/4] Deleting unnecessary SessionRecords test files. --- .../TranslationLiveTests/TranslateBasic.json | 42 ------------------- .../TranslateBasicAsync.json | 42 ------------------- .../TranslateDifferentTextTypes.json | 42 ------------------- .../TranslateDifferentTextTypesAsync.json | 42 ------------------- .../TranslateFromLatinToLatinScript.json | 42 ------------------- .../TranslateFromLatinToLatinScriptAsync.json | 42 ------------------- .../TranslateMultipleTargetLanguages.json | 42 ------------------- ...TranslateMultipleTargetLanguagesAsync.json | 42 ------------------- .../TranslateWithAlignment.json | 42 ------------------- .../TranslateWithAlignmentAsync.json | 42 ------------------- .../TranslateWithAutoDetect.json | 42 ------------------- .../TranslateWithAutoDetectAsync.json | 42 ------------------- .../TranslateWithCustomEndpoint.json | 41 ------------------ .../TranslateWithCustomEndpointAsync.json | 41 ------------------ .../TranslateWithDictionaryTag.json | 42 ------------------- .../TranslateWithDictionaryTagAsync.json | 42 ------------------- .../TranslateWithIncludeSentenceLength.json | 42 ------------------- ...anslateWithIncludeSentenceLengthAsync.json | 42 ------------------- .../TranslateWithMultipleInputTexts.json | 42 ------------------- .../TranslateWithMultipleInputTextsAsync.json | 42 ------------------- .../TranslateWithNoTranslateTag.json | 42 ------------------- .../TranslateWithNoTranslateTagAsync.json | 42 ------------------- .../TranslateWithProfanity.json | 42 ------------------- .../TranslateWithProfanityAsync.json | 42 ------------------- .../TranslateWithToken.json | 41 ------------------ .../TranslateWithTokenAsync.json | 41 ------------------ .../TranslateWithTransliteration.json | 42 ------------------- .../TranslateWithTransliterationAsync.json | 42 ------------------- .../VerifyTransliterationTest.json | 41 ------------------ .../VerifyTransliterationTestAsync.json | 41 ------------------ ...VerifyTransliterationWithEditDistance.json | 41 ------------------ ...yTransliterationWithEditDistanceAsync.json | 41 ------------------ ...yTransliterationWithMultipleTextArray.json | 41 ------------------ ...sliterationWithMultipleTextArrayAsync.json | 41 ------------------ 34 files changed, 1418 deletions(-) delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json delete mode 100644 sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json deleted file mode 100644 index 2279e56f50937..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasic.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026from=es\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "23", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-f8548d4155047ef17dccde7b35953f8b-d366729a1d3e05aa-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "89ffef94966c342ca4f469c2bc4a8645", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022Hola mundo\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "53", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:13 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "10", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086DE" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022Ahoj sv\u011Bte\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "246203941", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json deleted file mode 100644 index 4248913ab2150..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateBasicAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026from=es\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "23", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-0944fe4f2cfdfd714cdd260a52720453-343753002a75bd6c-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "9b062b6f1135dbc76e3a53d2089f6504", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022Hola mundo\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "53", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "10", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08844" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022Ahoj sv\u011Bte\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "54674655", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json deleted file mode 100644 index b1b29f45da67a..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypes.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026textType=Html\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "121", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-b56aad3bda30a2095eb5c35b84d2777d-4139c48c95ad75a2-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "7eb90ee2fef690240b1a6960f7374a15", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u003Chtml\\u003E\\u003Cbody\\u003EThis \\u003Cb\\u003Eis\\u003C/b\\u003E a test.\\u003C/body\\u003E\\u003C/html\\u003E\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "137", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "48", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086E7" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Chtml\u003E\u003Cbody\u003EToto \u003Cb\u003Eje\u003C/b\u003E test.\u003C/body\u003E\u003C/html\u003E\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "818479780", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json deleted file mode 100644 index de7740f92ee77..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateDifferentTextTypesAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026textType=Html\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "121", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-ce8e4f5b27ba87efee393d659d2d7a1b-06b4766a9d8800cd-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "6559b6e16715e83ff3e97bbd3f92d5bc", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u003Chtml\\u003E\\u003Cbody\\u003EThis \\u003Cb\\u003Eis\\u003C/b\\u003E a test.\\u003C/body\\u003E\\u003C/html\\u003E\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "137", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "48", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08850" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Chtml\u003E\u003Cbody\u003EToto \u003Cb\u003Eje\u003C/b\u003E test.\u003C/body\u003E\u003C/html\u003E\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "10406007", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json deleted file mode 100644 index 6dc3e6a924a8e..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScript.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=ta\u0026from=hi\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "24", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-13bb5ea80bb135cd6c91a7dbe8f5434c-9f2b91a6bbf86b31-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "f316a320bd85c32262ac22b2728ad814", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022ap kaise ho\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "213", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "11", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F086F6" - }, - "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u090F\u092A\u0940 \u0915\u0948\u0938\u0947 \u0939\u094B\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u0B8E\u0BAA\u0BCD\u0BAA\u0B9F\u0BBF \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95\u0BBF\u0BB1\u0BBE\u0BAF\u0BCD?\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022eppadi irukkiraai?\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022ta\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "885938075", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json deleted file mode 100644 index 09517c4a4ec45..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateFromLatinToLatinScriptAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=ta\u0026from=hi\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "24", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-17517502863baa063d80a394b0d6b8e3-97de4d9f355afe48-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "b2b6f1327bd1aaec466f2bb3946c1a9e", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022ap kaise ho\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "213", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "11", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08857" - }, - "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u090F\u092A\u0940 \u0915\u0948\u0938\u0947 \u0939\u094B\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u0B8E\u0BAA\u0BCD\u0BAA\u0B9F\u0BBF \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95\u0BBF\u0BB1\u0BBE\u0BAF\u0BCD?\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022eppadi irukkiraai?\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022ta\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "347530639", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json deleted file mode 100644 index f5d6579bbf4df..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguages.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026to=es\u0026to=de\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-00a448cdac3c54c26789f9e33928af89-57d9d6d183f4486d-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "be49b184c5e871028269011e2409b40f", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "186", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "45", - "X-MT-System": "Microsoft,Microsoft,Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08705" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022,\u0022to\u0022:\u0022es\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022,\u0022to\u0022:\u0022de\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1643775044", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json deleted file mode 100644 index 33d410713f4a6..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateMultipleTargetLanguagesAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026to=es\u0026to=de\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-e0210babe96dd761fb4c0f368169bcc8-1a1d9fb66c40d064-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "65ed456c2349ba2c8b19c011ade81e6d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "186", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "45", - "X-MT-System": "Microsoft,Microsoft,Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08862" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022,\u0022to\u0022:\u0022es\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022,\u0022to\u0022:\u0022de\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1164865256", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json deleted file mode 100644 index af3e9d983076a..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignment.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026includeAlignment=true\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "38", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-aae403e063c54afaac9c8931920cf3f2-5080c59cc11f68ba-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "f3d5b9a935ec3d00f1626a8a80685a5d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "159", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "25", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08712" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022,\u0022alignment\u0022:{\u0022proj\u0022:\u00220:1-0:1 0:1-3:8 18:24-10:13\u0022}}]}]" - } - ], - "Variables": { - "RandomSeed": "883133905", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json deleted file mode 100644 index 508322f44c090..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAlignmentAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026includeAlignment=true\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "38", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-189f932a408e56ace522754218bcbd25-20d9addf2bb6a29a-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "dc2f3bd29e53c76e95c9a6172516982d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "159", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "25", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08870" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022,\u0022alignment\u0022:{\u0022proj\u0022:\u00220:1-0:1 0:1-3:8 18:24-10:13\u0022}}]}]" - } - ], - "Variables": { - "RandomSeed": "1691118378", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json deleted file mode 100644 index 22e496c37e89b..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetect.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-215ad245e04776b589537fbe85c52937-5c8da5e0888e1ae3-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "8469fa1caedea43fd81dbba9791cc375", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "105", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08721" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "742269699", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json deleted file mode 100644 index def66a683fe75..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithAutoDetectAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-2d89035fee0af5c9e6b1053f1fe968d4-807fc44acac65f20-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "311dedc37d498cae67af36ef6568e4d2", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "105", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0887A" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "2085760073", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json deleted file mode 100644 index fc4a24aa85d98..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpoint.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com/translator/text/v3.0/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "38", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-c488101bbcf26f269cd34493e34c97cf-9d2a97877ed58006-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "32e7657a076e21af2fd25721b10fac00", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": "X-RequestId,X-Metered-Usage", - "apim-request-id": "55117335-419b-44a7-a56f-116aad874733", - "Content-Length": "108", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "25", - "x-ms-region": "West US", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0875E" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "130081400", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_CUSTOM_ENDPOINT": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json deleted file mode 100644 index a5d8009f3ad17..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithCustomEndpointAsync.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com/translator/text/v3.0/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "38", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-530c82e3ba0b027c7b285b69dbc88e75-e12f6d34057126f1-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "a604cede46a31759fbbec085b8958fba", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022It is a beautiful morning\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": "X-RequestId,X-Metered-Usage", - "apim-request-id": "836d84f4-0786-417b-a3bd-abe709297ac6", - "Content-Length": "108", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "25", - "x-ms-region": "West US", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0888F" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Je kr\u00E1sn\u00E9 r\u00E1no\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "527291978", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_CUSTOM_ENDPOINT": "https://tdac18127a4f4f2c8.cognitiveservices.azure.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json deleted file mode 100644 index 900869e6a0865..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTag.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=es\u0026from=en\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "153", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-6909de961e03f15e537150ba30b7b17b-474eef040a2eff45-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "2b31619dbebd87ba0bca89440b30aa6d", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022The word \\u003C mstrans:dictionary translation =\\u0022wordomatic\\u0022\\u003Ewordomatic\\u003C/mstrans:dictionary\\u003E is a dictionary entry.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "164", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:14 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "110", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08780" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022La palabra \u003C mstrans:dictionary translation =\\\u0022wordomatic\\\u0022\u003Ewordomatic\u003C/mstrans:dictionary\u003E es una entrada de diccionario.\u0022,\u0022to\u0022:\u0022es\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "925755453", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json deleted file mode 100644 index 0c9ed67a905bf..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithDictionaryTagAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=es\u0026from=en\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "153", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-6bc7b8f09bd822ec404d81ce10386b83-1b4e67d4ebdaa71a-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "5afa96d4a8d1eff30420c7832bdbaa1e", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022The word \\u003C mstrans:dictionary translation =\\u0022wordomatic\\u0022\\u003Ewordomatic\\u003C/mstrans:dictionary\\u003E is a dictionary entry.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "164", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "110", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088C2" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022La palabra \u003C mstrans:dictionary translation =\\\u0022wordomatic\\\u0022\u003Ewordomatic\u003C/mstrans:dictionary\u003E es una entrada de diccionario.\u0022,\u0022to\u0022:\u0022es\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1852603014", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json deleted file mode 100644 index 94e151e02e2ad..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLength.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=fr\u0026includeSentenceLength=true\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "315", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-fdfc169513f638380285a0ff1b51f0bf-6ae20e4105ef9ed2-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "992e9dd85ea4bb7eaac46383d8fde4f7", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022La r\\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\\u00E9es \\u00E0 un site ou des utilisateurs comme un \\u00EAtre humain. Il suffit de copier et coller un extrait de code n\\u0027importe o\\u00F9.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "432", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "272", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087A1" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022fr\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022La r\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\u00E9es \u00E0 un site ou des utilisateurs comme un \u00EAtre humain. Il suffit de copier et coller un extrait de code n\u0027importe o\u00F9.\u0022,\u0022to\u0022:\u0022fr\u0022,\u0022sentLen\u0022:{\u0022srcSentLen\u0022:[53,157,62],\u0022transSentLen\u0022:[53,157,62]}}]}]" - } - ], - "Variables": { - "RandomSeed": "1526704476", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json deleted file mode 100644 index bcd919116d20f..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithIncludeSentenceLengthAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=fr\u0026includeSentenceLength=true\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "315", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-366e4b3757e9ffce6ea7961a3a82e821-b44c918190e6835a-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "91daf351d94dbb30975fd45fb4cb1537", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022La r\\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\\u00E9es \\u00E0 un site ou des utilisateurs comme un \\u00EAtre humain. Il suffit de copier et coller un extrait de code n\\u0027importe o\\u00F9.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "432", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "272", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088D5" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022fr\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022La r\u00E9ponse se trouve dans la traduction automatique. La meilleure technologie de traduction automatique ne peut pas toujours fournir des traductions adapt\u00E9es \u00E0 un site ou des utilisateurs comme un \u00EAtre humain. Il suffit de copier et coller un extrait de code n\u0027importe o\u00F9.\u0022,\u0022to\u0022:\u0022fr\u0022,\u0022sentLen\u0022:{\u0022srcSentLen\u0022:[53,157,62],\u0022transSentLen\u0022:[53,157,62]}}]}]" - } - ], - "Variables": { - "RandomSeed": "486864016", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json deleted file mode 100644 index 2293c1e5402a4..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTexts.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "89", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-d89387673cd8124811c51a8145f9d075-5688bd1f880f10ac-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "af79da81ee7a8c9977a73c1c458c7378", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "313", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "52", - "X-MT-System": "Microsoft,Microsoft,Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087A8" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022es\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022de\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "896702095", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json deleted file mode 100644 index f9f935e59b9f7..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithMultipleInputTextsAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "89", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-afbd31d7500ba1f0f6dfe04633d24ddf-8051c386196cfb01-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "ac9dcd88ecc3aa7e36525177d747f028", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022},{\u0022text\u0022:\u0022Esto es una prueba.\u0022},{\u0022text\u0022:\u0022Dies ist ein Test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "313", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "52", - "X-MT-System": "Microsoft,Microsoft,Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088E8" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022es\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]},{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022de\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1621916574", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json deleted file mode 100644 index 02274f3752255..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTag.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=en\u0026from=zh-chs\u0026textType=Html\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "142", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-71f7b5d3093272dd484632afa5161c2e-001ff05366f4f0f3-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "993ef21a66e45d2bb26836ece04794b6", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u003Cspan class=notranslate\\u003E\\u4ECA\\u5929\\u662F\\u600E\\u4E48\\u56DE\\u4E8B\\u662F\\u003C/span\\u003E\\u975E\\u5E38\\u53EF\\u6015\\u7684\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "107", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "44", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087B2" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Cspan class=notranslate\u003E\u4ECA\u5929\u662F\u600E\u4E48\u56DE\u4E8B\u662F\u003C/span\u003Every scary\u0022,\u0022to\u0022:\u0022en\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1489171728", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json deleted file mode 100644 index d797cb1528d34..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithNoTranslateTagAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=en\u0026from=zh-chs\u0026textType=Html\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "142", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-23c6fa36d20826cfa73e09895f3c3ef2-cf667ca257118bff-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "bbb1be8178dbef83ceec9eab652d9469", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u003Cspan class=notranslate\\u003E\\u4ECA\\u5929\\u662F\\u600E\\u4E48\\u56DE\\u4E8B\\u662F\\u003C/span\\u003E\\u975E\\u5E38\\u53EF\\u6015\\u7684\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "107", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "44", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F088F9" - }, - "ResponseBody": "[{\u0022translations\u0022:[{\u0022text\u0022:\u0022\u003Cspan class=notranslate\u003E\u4ECA\u5929\u662F\u600E\u4E48\u56DE\u4E8B\u662F\u003C/span\u003Every scary\u0022,\u0022to\u0022:\u0022en\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1428461796", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json deleted file mode 100644 index 2ce9d4d845890..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanity.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-cn\u0026profanityAction=Marked\u0026profanityMarker=Asterisk\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "39", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-53b7a11e7da25d97f50d5795ca81e248-55ef21cfbc5268ad-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "ec3a1df4018aca220d224d82085cdd63", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022shit this is fucking crazy\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "123", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "26", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F087CA" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u5988\u7684\uFF0C\u8FD9***\u592A\u75AF\u72C2\u4E86\u0022,\u0022to\u0022:\u0022zh-Hans\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1981466251", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json deleted file mode 100644 index 92d51545296e6..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithProfanityAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-cn\u0026profanityAction=Marked\u0026profanityMarker=Asterisk\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "39", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-73218ef9289b3b05b041dab44cb42894-7ece4ab2066a01a8-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "9a69ad0f960f109a5c38e0faa5834044", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022shit this is fucking crazy\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "123", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "26", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08903" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u5988\u7684\uFF0C\u8FD9***\u592A\u75AF\u72C2\u4E86\u0022,\u0022to\u0022:\u0022zh-Hans\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1350797198", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json deleted file mode 100644 index dc0c6ed3731d9..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithToken.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Authorization": "Sanitized", - "Content-Length": "28", - "Content-Type": "application/json", - "traceparent": "00-ee41a750ebcb5646951503c49ef9ed86-0d109255d65f1a39-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "de8fc3c0e3b3927cf86e57b6cd188c43", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "105", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0882A" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "374192827", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json deleted file mode 100644 index bfcbfa632ef35..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTokenAsync.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=cs\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Authorization": "Sanitized", - "Content-Length": "28", - "Content-Type": "application/json", - "traceparent": "00-3fadcf2c149e6e42dcaaa65947386ce8-2325df1472eaf33b-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "db92b052d3c7d7c7b8c9db015c0c81bc", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022This is a test.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "105", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08926" - }, - "ResponseBody": "[{\u0022detectedLanguage\u0022:{\u0022language\u0022:\u0022en\u0022,\u0022score\u0022:1.0},\u0022translations\u0022:[{\u0022text\u0022:\u0022Tohle je test.\u0022,\u0022to\u0022:\u0022cs\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "746316710", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json deleted file mode 100644 index 1f51318915d2f..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliteration.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-Hans\u0026from=ar\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-fcaed6c5e4327aa25dd9f3ef180c8b70-22d7e7716fd912ad-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "229a12c93a8dbcfad666d2e2b3606eac", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022hudha akhtabar.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "179", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:15 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F08833" - }, - "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631.\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u8FD9\u662F\u4E2A\u6D4B\u8BD5\u3002\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022zh\u00E8 sh\u00ECg\u00E8 c\u00E8sh\u00EC\u3002\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022zh-Hans\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "1721483215", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json deleted file mode 100644 index cc85ac057b734..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TranslationLiveTests/TranslateWithTransliterationAsync.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/translate?to=zh-Hans\u0026from=ar\u0026fromScript=Latn\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "28", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-f1a95372009300c3534db32e513024da-dc0c1446ef3c2dc9-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "00ab489d1ee08ed764cf544fca8a64c7", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022hudha akhtabar.\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "179", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "15", - "X-MT-System": "Microsoft", - "X-RequestId": "TRAN.MW1P.99BF.0403T2150.2F0892E" - }, - "ResponseBody": "[{\u0022sourceText\u0022:{\u0022text\u0022:\u0022\u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631.\u0022},\u0022translations\u0022:[{\u0022text\u0022:\u0022\u8FD9\u662F\u4E2A\u6D4B\u8BD5\u3002\u0022,\u0022transliteration\u0022:{\u0022text\u0022:\u0022zh\u00E8 sh\u00ECg\u00E8 c\u00E8sh\u00EC\u3002\u0022,\u0022script\u0022:\u0022Latn\u0022},\u0022to\u0022:\u0022zh-Hans\u0022}]}]" - } - ], - "Variables": { - "RandomSeed": "408784969", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json deleted file mode 100644 index fa9364efafe8a..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=zh-Hans\u0026fromScript=Hans\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "56", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-fdf9beb15cc5d71e24dac2910475fe9e-a38c1d007397156c-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "48a0486d0fb96d0f3826747f8b0bf1cf", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u8FD9\\u91CC\\u600E\\u4E48\\u4E00\\u56DE\\u4E8B?\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "56", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "8", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F08931" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022zh\u00E8l\u01D0 z\u011Bnme y\u00EChu\u00EDsh\u00EC?\u0022,\u0022script\u0022:\u0022Latn\u0022}]" - } - ], - "Variables": { - "RandomSeed": "1326958711", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json deleted file mode 100644 index ecc120a2054d3..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationTestAsync.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=zh-Hans\u0026fromScript=Hans\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "56", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-f76c4370371d5372eaa6e0a103d47577-1141a1dd932ddcfa-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "348406db74bd909307f9996bd72d436a", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u8FD9\\u91CC\\u600E\\u4E48\\u4E00\\u56DE\\u4E8B?\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "56", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "8", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0895B" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022zh\u00E8l\u01D0 z\u011Bnme y\u00EChu\u00EDsh\u00EC?\u0022,\u0022script\u0022:\u0022Latn\u0022}]" - } - ], - "Variables": { - "RandomSeed": "116707324", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json deleted file mode 100644 index 54c636bb1b979..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistance.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=gu\u0026fromScript=latn\u0026toScript=gujr\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "58", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-09a06d2508c7c14ce89b8e12dcc91a9a-067f89d3fbef2a0e-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "8bb4201d189aa076cfbb17fda8578b39", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022gujarat\u0022},{\u0022text\u0022:\u0022hadman\u0022},{\u0022text\u0022:\u0022hukkabar\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "148", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "21", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0893A" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC7\u0AA1\u0AAE\u0AC7\u0AA8\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC1\u0A95\u0ACD\u0A95\u0ABE\u0AAC\u0ABE\u0AB0\u0022,\u0022script\u0022:\u0022gujr\u0022}]" - } - ], - "Variables": { - "RandomSeed": "531091503", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json deleted file mode 100644 index 988dbdaa10660..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithEditDistanceAsync.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=gu\u0026fromScript=latn\u0026toScript=gujr\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "58", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-8ed457e2b0f7b6144a23c44373600655-9180f2b6fa088be7-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "7866674fdddcafe96246585a937b0300", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022gujarat\u0022},{\u0022text\u0022:\u0022hadman\u0022},{\u0022text\u0022:\u0022hukkabar\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "148", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "21", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0896A" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC7\u0AA1\u0AAE\u0AC7\u0AA8\u0022,\u0022script\u0022:\u0022gujr\u0022},{\u0022text\u0022:\u0022\u0AB9\u0AC1\u0A95\u0ACD\u0A95\u0ABE\u0AAC\u0ABE\u0AB0\u0022,\u0022script\u0022:\u0022gujr\u0022}]" - } - ], - "Variables": { - "RandomSeed": "1451694606", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json deleted file mode 100644 index 880ab5902fd7a..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArray.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=hi\u0026fromScript=Deva\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "223", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-d556cf200587daf1580ebce3d8fd6230-dcfd199e539c8a1f-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "6bd397b0b7a4a07dc8977e4a31ccc7fe", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022},{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "96", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "33", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F08949" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022yhekakasautihekasautihai\u0022,\u0022script\u0022:\u0022Latn\u0022},{\u0022text\u0022:\u0022yhekakasoutihai\u0022,\u0022script\u0022:\u0022Latn\u0022}]" - } - ], - "Variables": { - "RandomSeed": "44988461", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -} diff --git a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json b/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json deleted file mode 100644 index 66004a67aa298..0000000000000 --- a/sdk/translation/Azure.AI.Translation.Text/tests/SessionRecords/TransliterationLiveTests/VerifyTransliterationWithMultipleTextArrayAsync.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://api.cognitive.microsofttranslator.com/transliterate?language=hi\u0026fromScript=Deva\u0026toScript=Latn\u0026api-version=3.0", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "223", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "Ocp-Apim-Subscription-Region": "westus", - "traceparent": "00-bf118c6cb0c828b2a74bcd1eefb9baf9-50086dc8310e4628-00", - "User-Agent": "azsdk-net-AI.Translation.Text/1.0.0-alpha.20230403.1 (.NET 6.0.15; Microsoft Windows 10.0.22624)", - "x-ms-client-request-id": "e4ab4eebb19ee582de86498704a1b4a4", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": "[{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022},{\u0022text\u0022:\u0022\\u092F\\u0939\\u090F\\u0915\\u0915\\u0938\\u094C\\u091F\\u0940\\u0939\\u0948\u0022}]", - "StatusCode": 200, - "ResponseHeaders": { - "Access-Control-Expose-Headers": [ - "X-RequestId", - "X-Metered-Usage" - ], - "Content-Length": "96", - "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 03 Apr 2023 21:50:16 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-Content-Type-Options": "nosniff", - "X-Metered-Usage": "33", - "X-RequestId": "TLIT.MW1P.99BF.0403T2150.2F0897C" - }, - "ResponseBody": "[{\u0022text\u0022:\u0022yhekakasautihekasautihai\u0022,\u0022script\u0022:\u0022Latn\u0022},{\u0022text\u0022:\u0022yhekakasoutihai\u0022,\u0022script\u0022:\u0022Latn\u0022}]" - } - ], - "Variables": { - "RandomSeed": "560855002", - "TEXT_TRANSLATION_API_KEY": "Sanitized", - "TEXT_TRANSLATION_ENDPOINT": "https://api.cognitive.microsofttranslator.com", - "TEXT_TRANSLATION_REGION": "westus" - } -}