Phrase alignment and addiitional information

667 views
Skip to first unread message

Rafael Carrascosa

unread,
Aug 14, 2015, 2:35:26 PM8/14/15
to Google Translate API Developer Forum
Hi all,

It's known that the google translate website has access to an API that returns additional information like:
 - Phrase alignment
 - Word definitions
 - Alternative translations

I would like to access the "phrase alignment" information (and more if it were possible) using the google translate API paid service... Is this in any way possible?

I understand that use of the API is not documented, but I believe this information must be there somewhere... Does anyone has a hint of any additional parameters that might be used with the API to get this information?
It would be very useful to me even if it is unsupported, undocumented and someone is going to pull the plug on it tomorrow.


Regards!


P.S.: I'm aware of the 'dt' parameter on the web API, I'm looking for something like that on the V2 API.

Patrice (Google Cloud Support)

unread,
Aug 14, 2015, 4:05:53 PM8/14/15
to Google Translate API Developer Forum
Hi Rafael!

Using directly the Translate API, you won't be able to get that. There might be, as you say, an undocumented API that can do this, but honestly I don't know of it. Maybe someone else from the community can come in and share their experience if they found it.

The one thing I'm not clear on is the "phrase alignment" you mention. What exactly do you mean by that? 

As a side note, for the "alternative translations" point, it can't be done with the Translate API as mentioned on the FAQ here.  

Cheers

Rafael Carrascosa

unread,
Aug 14, 2015, 4:33:43 PM8/14/15
to Google Translate API Developer Forum
Hi Patrice!

Thank you for your quick reply :)

Regarding you question about "phrase alignment": It is the fine grained information of word correspondences inside a translated sentence.
For example, translating "The yellow house is nice" into "La casa amarrilla es linda" you might have the following phrase alignments:
0-0 (The == La)
1-2 (yellow == amarilla)
2-1 (house == casa)
3-3 (is == es)
4-4 (nice == linda)

This information is computed by almost every modern machine translation system and is used in the google translate web site to highlight this correspondence between words.
The information comes from an API as it can be seen with this curl line:

Ie: google computes this info and it's more-or-less available somewhere.


Thanks again for your quick reply and, as you said, I hope some member of the community can share it's experience on some undocumented feature that helps me out.


P.S.: I could use the same API as the web service to solve my problem but a) I don't want to be banned b) I want to pay for the service!

Tim Uy

unread,
Oct 18, 2016, 5:51:32 PM10/18/16
to Google Translate API Developer Forum
Rafael, did you ever make progress on phrase alignment?

Rafael Carrascosa

unread,
Oct 18, 2016, 6:28:28 PM10/18/16
to Google Translate API Developer Forum
Hi Tim,

Yes, sort of.
I ended up using yandex: https://tech.yandex.com/translate/
Yandex does not provides alignment information either, but unofficially it does, even in the paid service.
If you send "options=4" in the query string of the url it returns alignment information. This is undocumented and unsopported, but I have been using it non-stop for a year without problems.

Good luck!

Tim Uy

unread,
Nov 8, 2017, 9:20:18 AM11/8/17
to Google Cloud Translation API
Rafael, thanks for your response. I'm not sure why I missed it before. Is it still working? I found that Microsoft also gives some word alignment information - although with all the NN stuff, there might be a gap.

Rafael Carrascosa

unread,
Nov 8, 2017, 11:47:10 AM11/8/17
to Google Cloud Translation API
Hey Tim,

I moved to another project so I really don't know if this is still working. But since Yandex API keys are free (for a limited use) you could check it out at no cost.
Thanks for the tip about Microsoft, and I totally agree: With the NN furor you never know when alignments are going to stop making sense at all.

Cheers!
Reply all
Reply to author
Forward
0 new messages