Skip to content
Advertisement

How to get translation groups from Microsoft Translator?

If you go to https://www.bing.com/translator, (which uses the MS/Azure Translator api) and type in the word mean from English to Swedish, in addition to the “main” translation you get on the right, you also have a section that has “Other ways to say”, which are grouped by Verb, Noun, and Adjective.

Example

I would like to know how I can fetch this list of groups from the response.

Right now I have the following, but it only returns the main translation, in this case Menar.

JavaScript

AzureTranslatorResponse

JavaScript

DetectedLanguage

JavaScript

DetectedLanguage

JavaScript

Advertisement

Answer

You can retrieve alternative translations using the Dictionary Lookup resource. https://learn.microsoft.com/azure/cognitive-services/translator/reference/v3-0-dictionary-lookup

It returns the part of speech in the posTag attribute. You can then group by posTag to achieve a similar grouping.

The Dictionary Examples resource returns the example sentences that you see on the Bing Translator site as well. https://learn.microsoft.com/azure/cognitive-services/translator/reference/v3-0-dictionary-examples

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement