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

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

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 Cognitive Services
Azure Cognitive Services
A group of Azure artificial intelligence services and cognitive APIs that help build intelligent apps.
936 questions
Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
221 questions
No comments
{count} votes

1 answer

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

    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

    No comments