Translation
Translate text from one language to another
Translation is the process of converting text from one language to another while preserving its meaning. This task is essential for breaking down language barriers and enabling communication across different cultures.
Running Translation with supercontrast
is straightforward. You need to provide the text to translate, specify the source and target languages, and choose the provider you want to use.
In this example, we’ll use Task.TRANSLATION
with Provider.AZURE
(Microsoft’s Azure Translator service) to translate text from English (source_language="en"
) to French (target_language="fr"
).
Note: Language codes can be found here.
Each task has its own request and response schema. For Task.TRANSLATION
, the request schema is defined by TranslationRequest
and the response schema is defined by TranslationResponse
.
text
: a string of the text to be translated.
text
: a string of the translated text