Translate Italian to French - Azure Speech Translation Solution

Translate Italian to French

Question

You have a requirement to translate the Italian language to the French language during Speech translation in Azure.

Review the code below and complete it by choosing two answer choices.

static async Task TranslateSpeechAsync() { var translationConfig = SpeechTranslationConfig.FromSubscription(SPEECH__SUBSCRIPTION__KEY, SPEECH__SERVICE__REGION); ………………………………….

= "it-IT"; …………………………………...("fr"); }

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answers: A and C

Here is the completed code:

<pre>static async Task TranslateSpeechAsync()

{

var translationConfig =

SpeechTranslationConfig.FromSubscription(SPEECH__SUBSCRIPTION__KEY, SPEECH__SERVICE__REGION);

translationConfig.SpeechRecognitionLanguage = "it-IT";

translationConfig.AddTargetLanguage("fr");

}

</pre>Option A is correct because you would use the SpeechRecognitionLanguage property of SpeechTranslationConfig to specify the source language.

In this case, the source language is Italian.

Option B is incorrect because the TranslationRecognizer class translates speech into text.

It is not a property of translationConfig.

Instead, it uses translationConfig as an input parameter.

Option C is correct because the AddTargetLanguage property specifies the target language.

In this case, French is the target language.

Option D is incorrect because the objective is to add a target language.

The removeTargetLanguage method is used to remove a target language of translation.

Hence it is not the correct choice here.

Reference:

To learn more about Speech Translation, use the link given below:

The code is incomplete and requires modifications to translate Italian language to French language during speech translation in Azure. The SpeechTranslationConfig class provides configuration settings for speech translation, including subscription key and service region.

Option A is incorrect because SpeechRecognitionLanguage property specifies the language used for speech recognition, not translation.

Option B is incorrect because TranslationRecognizer is a separate class used for translation without speech recognition.

Option C is the correct answer because AddTargetLanguage method adds a new target language to translate the audio into, which in this case is French. The code should look like the following:

csharp
static async Task TranslateSpeechAsync() { var translationConfig = SpeechTranslationConfig.FromSubscription(SPEECH_SUBSCRIPTION_KEY, SPEECH_SERVICE_REGION); translationConfig.SpeechRecognitionLanguage = "it-IT"; translationConfig.AddTargetLanguage("fr"); }

Option D is incorrect because there is no need to remove any target language in this case.

In summary, the correct answers are A. translationConfig.AddTargetLanguage and B. translationConfig.SpeechRecognitionLanguage.