Custom Translations
Define Custom Translations
Although Azure AI
Translator's default translation model works well for general translation, you
might need to create a translation solution for companies or sectors with
particular vocabularies of terms that call for specialized translation.
To solve this problem,
you can create a custom model that maps your own sets of source and target
terms for translation. To create a custom model, use the Custom Translator
portal to-
- Create a workspace linked to your Azure AI Translator resource.
- Create a project.
- Upload training data files and train a model
- Test your model and publish your model.
- Make translation calls to the API.
You can use the category
parameter in translate calls to your Azure AI Translator resource to specify
the unique category Id that your custom model has been assigned. This will
cause your custom model to execute translation rather than the default model.
How To Call The API ?
To initiate a
translation, you send a POST request to the following request URL-
https://api.cognitive.microsofttranslator.com/translate?api-version=3.0
Your request needs to include a couple of parameters:
- api-version- The
required version of the API.
- to- The target language to
translate to.
- Category-
Your category Id.
Your request must also include a number of required
headers-
- Ocp-Apim-Subscription-Key-
Header for your client key.
- Content-Type-
The content type of the payload.
The request body should
contain an array that includes a JSON object with a Text property that
specifies the text that you want to translate. There are different ways you can
send your request to the API, including using the C#, Python, and curl.
Response Returned
The response returns a
response code of 200 if the request was successful. It also returns a response
body that contains the translated text. If the request wasn't successful, then
a number of different status codes may be returned depending on the error type,
such as 400 (missing or invalid query parameters).
Conclusion
We have successfully
learnt about custom translations.
Comments
Post a Comment