question

RajeshVoleti-4097 avatar image
RajeshVoleti-4097 asked ·

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

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

https://docs.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-servicesazure-translator
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

GiftA-MSFT avatar image
GiftA-MSFT answered ·

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



qna.png (11.5 KiB)
Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.