將逐字稿翻譯成英文
既然已經產生了客戶通話的逐字稿,接下來要把它翻譯成英文以便後續處理。
你先前建立的逐字稿已存於 transcript,而國別代碼則存於 country_code。
本練習屬於課程
使用 OpenAI API 的多模態系統
練習說明
- 將
transcript中的文字翻譯成英文。 - 從
response中擷取逐字稿文字。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
client = OpenAI(api_key="")
# Translate the transcript into English
response = ____
# Extract the translated transcript text
en_transcript = ____
print(en_transcript)