Google Translate REST API, getting the Nouns, Adjective,ect

霸气de小男生 提交于 2019-12-13 03:42:03

问题


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.



来源:https://stackoverflow.com/questions/49837371/google-translate-rest-api-getting-the-nouns-adjective-ect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!