hiexam
microsoft · AI-102 · Q645 · code_completion · speech_translation, code_completions, azure_sdk

HOTSPOT - You are developing a service that records lectures given in English (United Kingdom). You have a method nam…

HOTSPOT - You are developing a service that records lectures given in English (United Kingdom). You have a method named append_to_transcript_file that takes translated text and a language identifier. You need to develop code that will provide transcripts of the lectures to attendees in their respective language. The supported languages are English, French, Spanish, and German. How should you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. //IMG//
speech_key = os.environ['SPEECH__SUBSCRIPTION__KEY']
service_region = os.environ['SPEECH__SERVICE__REGION']

def translate_speech():
    translation_config = speechsdk.translation.SpeechTranslationConfig(
        subscription=speech_key, region=service_region)
    translation_config.speech_recognition_language = "en-GB"

    languages = {{slot1}}

    for language in languages:
        translation_config.add_target_language(language)

    audio_config = speechsdk.audio.AudioConfig(use_default_microphone=True)
    recognizer = speechsdk.translation.{{slot2}}
    
    translation_config=translation_config, audio_config=audio_config

    result = recognizer.recognize_once()
    if result.reason == speechsdk.ResultReason.TranslatedSpeech:
        append_to_transcript_file(result.text, "en")
        for language in result.translations:
            append_to_transcript_file(result.translations[language], language)
Correct slot values

Answer hidden

Unlock AI-102

First 5 questions of every exam are free. Unlock the rest.

Includes
  • · All — questions
  • · Verified answers + AI explanations
  • · Spaced-repetition mistake notebook
  • · Phone, tablet, laptop sync

One-time payment. Doesn't auto-renew. · Already paid? Sign in