How to specify gender in Google Cloud Translation API

Viewed 204

I am using Google Cloud Translation API in one of my projects. I want to specify the gender for the translation. I am unable to find about this in Google Cloud Translation. I have also searched a lot on the Internet but not found any way to do this. I know how to specify the gender in Google Text to Speech API using the SSML, but I need it for the translation. Any help will be highly appreciated.

2 Answers

After much searching I have discovered that there is currently no way to do this.

I have made a feature request along these lines at the invitation of GCP support.

The documentation indicates that feature requests are prioritised by how often an issue is starred, so for now my best answer is to star the issue here so that they know how many people are interested in this.

Looking for the same...

As it is NMT (Neural Machine Translation), it reacts to context.

I tried many combinations and found that this works well so far (says, not 'to', not 'talk'). Examples are EN > ES enter image description here

However, sometimes its effect doesn't reach far in the translation. enter image description here

So you have to stick the 'prefix' before each sentence. enter image description here

Sometimes you get irregular behavior (see lower case "estoy"). And when you change something irrelevant (to you, but not to the model) ... buala!

enter image description here

So the final version (for now) is: enter image description here

I guess the point is:

  • Understanding how it works (Machine Learning Language Models)
  • The Model (Algorithm) they use is evolving, so you need to keep an eye, as what works today may break tomorrow.

Once you get the response you will have to filter out you 'prefix', but that is not too difficult.

Please comment if you find better ways (or the API gets updated).

Related info: https://ai.googleblog.com/2018/12/providing-gender-specific-translations.html

Related