How can i get the transliterated version or pronounciation of a word with google cloud translate API?

115 Views Asked by At

Here is an example for the problem I am dealing with: I have Chinese words written in Chinese characters, and I need to get the transliterated (NOT translated!) version of that word in Latin letters (some may call this also the "pronunciation" of the word in Latin letters). Example:

  • Chinese term: 王
  • Translation in English: King
  • Transliteration in Latin letters: Wáng ("pronunciation", the part we want)

I noticed that Google translate (GT) actually provides this information, as seen in this screenshot below where i marked the transliteration with red in the left bottom:

Google translate providing transliteration circled in red.

So, this tells me that technically GTs API must be able to provide this if they are using it here, but when I looked for requests in the network tab of my browser I noticed that Google sends back JavaScript code instead of pure data responses. Since I didn't get much wiser looking at it, I moved over to the google cloud translate API documentation for the Java library (https://cloud.google.com/java/docs/reference/google-cloud-translate/latest/com.google.cloud.translate). I read through both the basic and advanced guides for the language, created an API key and played around sending requests to the translate API for translations which all worked fine.

However, i couldn't find any clue on if this specific type of information can be received or requested or how via the API. I know that google also has a transliterate API, but it is deprecated since 2011 and I feel like this must be built into the translate API and there seems to be only a JS version of the transliterate API. (https://developers.google.com/transliterate/v1/getting_started)

Does anyone know how one can request/receive this the transliterated term or written pronunciation from the Google cloud translate API? Maybe I missed it in the documentation, in which case I would appreciate any input for redirection.

1

There are 1 best solutions below

0
On

Already answered here but since it's an old issue.

That feature is currently in preview under the Cloud Translation API (Translate Text Advanced v3) offering.

Transliteration is a configuration setting in the translateText method. When you enable transliteration, you translate romanized text (Latin script) directly to a target language.

https://cloud.google.com/translate/docs/advanced/translating-text-v3#transliteration

No news on when it will go GA (generally available).