Will Microsoft Translator API returns the translated texts in the same order as input array of texts or not?

Rajesh Voleti 1 Reputation point
2020-05-20T15:33:34.273+00:00

As per the below link, Microsoft Translator API accepts an array of texts that can be translated to the specified target languages.

https://learn.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-translate

In response, Microsoft Translator API returns an array of JSON objects with translated texts.

Can someone please confirm whether Microsoft Translator API returns the translated texts in the same order as input array of texts or not?. It is not mentioned properly in the documentation.

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
368 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,635 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GiftA-MSFT 11,161 Reputation points
    2020-05-21T05:34:48.633+00:00

    Hi,

    Yes I can confirm that Translator API returns translated tests in same order as input. Try this example:

    curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=en&to=en" -H "Ocp-Apim-Subscription-Key: <**your-key**>"-H "Ocp-Apim-Subscription-Region: <**your-region**>" -H "Content-Type: application/json; charset=UTF-8" -d "[{'Text':'Hey there?'}, {'Text': 'How is your day going?'}, {'Text': 'I am fine, thank you.'}]"  
    

    8571-qna.png

    1 person found this answer helpful.
    0 comments No comments