Google Translate REST API, getting the Nouns, Adje

2019-08-24 08:08发布

问题:

I am using the Google Translate REST API with Embarcadero Delphi language.

I wrote my own wrapper for the translate call > https://translation.googleapis.com/language/translate/v2

This was pretty straight forward and works fine.

My only question is: When I use the public Google site to translate words, I will get a section that will show Nouns/Adjectives, etc. associated to the word.

Example

Translate Hebrew (iw) word of דָּוָה into English (en)

The translated text I get via the API call and the Public site is "Dove" and that's all.

But on the public site it shows this below the translation box.

Translations of דָוֶה

adjective

sick חוֹלֶה, חוֹלָנִי, חָשׁ בְּחִילָה, כּוֹאֵב, דַוָי, דָוֶה

sad עָצוּב, נוּגֶה, מַעֲצִיב, מְצַעֵר, דַוָי, אָנוּן

wretched אוּמלָל, עָלוּב, מִסכֵּן, עָנִי, אֶביוֹן, דָוֶה

Is this information obtainable via the API? It doesn't seem so.

I have been looking over the docs @ https://cloud.google.com/translate/docs/reference/translate

and I don't see anything about this ability being exposed.

To get an idea here is the JSON being sent and the received response.

Request >>>

{
  "q": "\u05d3\u05bc\u05b8\u05d5\u05b8\u05d4",
  "target": "en",
  "format": "text",
  "source": "iw",
  "model": "nmt"
}

<<< Response

{
  "data": {
    "translations": [
      {
        "translatedText": "Dove",
        "model": "nmt"
      }
    ]
  }
}

回答1:

Polysemy information is not provided via the API as you can read in the translate method documentation (as you have mentioned in your post) or as you can test using the translation API.

Looking for feature requests related, I have found this one which, despite not being exactly the same, is on the same track. You could “star” it to indicate your interest in the issue, which is used to prioritize the work on the platform.