Use this file to discover all available pages before exploring further.
This Cookbook walks through how to translate AssemblyAI transcripts using a variety of commerical and open-source machine translation models.Choosing a model depends on your use-case and preferences. Here are some considerations you may want to make when choosing a model to use for translation:
Accuracy and Quality of Translation: you should compare the translations from each provider to see which translation you prefer
from google.cloud import translate_v2def translate(target: str, text: str) -> dict: """Translates text into the target language. Target must be an ISO 639-1 language code. See https://g.co/cloud/translate/v2/translate-reference#supported_languages """ from google.cloud import translate_v2 as translate translate_client = translate.Client() if isinstance(text, bytes): text = text.decode("utf-8") # Text can also be a sequence of strings, in which case this method # will return a sequence of results for each text. result = translate_client.translate(text, target_language=target) print("Text: {}".format(result["input"])) print("Translation: {}".format(result["translatedText"])) print() return resultfor sent in transcript.get_sentences(): translate(to_lang, sent.text)