Please see: cloud.google.com/translate/docs/premium
The pertinent information is:
To direct the Google Cloud Translation API to use its premium edition, instead of its standard edition, pass a model parameter set to nmt within the request.
The model parameter is a string that currently supports the following values:
base (default) uses the standard edition
nmt uses the premium edition using a Neural Machine Translation model
Perhaps we could have a new line in OmegaT.l4J.ini to set this "model" parameter to either "base" or "nmt"?
For reference, I tried the following request URL manually and got the desired results.
I tried changing the src\org\omegat\core\machinetranslators\Google2Translate.java file by adding the line params.put("model", "nmt");, compiled sucessfully, and tried it out (as a hacky way to get quick results). However, the resulting translations all appear to be using the old engine.
Any good reasons why this wouldn't be working?
edit: to field the obvious first question "do you actually have beta access?" - yes, I was sent a confirmation e-mail from google cloud confirming so. (also proved this to myself with the above direct URL test)
Last edit: Norgus 2016-12-10
See [#1293] for additional descriptions.
Didier
Related
Feature Requests:
#1293I think, the easiest way to get this done would be to add a property "google.api.premium=true" and set the "model" attribute of the API request to "mnt" if the property is true.
Implemented in SVN (/trunk).
The "Premium" field is available in the Google MT dialog.
Didier
Last edit: Didier Briel 2017-01-02
There's also a command-line parameter: google.api.premium=true
Didier
Actually, the modifications don't seem to trigger the new translation engine. We are currently using an old URL to call the service (https://www.googleapis.com/language/translate/v2) instead of the new one (https://translation.googleapis.com/language/translate/v2). The old one ignores the "model" parameters. However, when I am testing the NMT engine with the new URL, there's always a HTTP error returned -- although it very well may be a problem on my end.
In the future, please test to make sure it actually works before you commit to trunk.
I have reverted the status to "accepted" until you report success.
Didier
I tried the most recent trunk build, and it does indeed appear to still be returning the translations from the old engine.
Samuel has a working solution:
https://groups.yahoo.com/neo/groups/OmegaT/conversations/messages/40220
Perhaps you can see from there what's wrong.
Didier
Implemented in /trunk.
Google Premium now works as expected.
Didier
My google.api.key works in 4.1.0 (with premium.edition checkbox checked).
On 4.1.1 compiled yesterday 2017-02-13 (from trunk) I get "400: Bad Request <google translate="" v2=""></google>
As far as I can tell, this should work correctly in 4.1.1. Does the translation works if you try it in a browser with an URL like the following ?
https://translation.googleapis.com/language/translate/v2?key=MY_API_KEY&source=en&target=fr&q=Hello%20World
I am in Win10.
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode)
The translation API works in Chrome. I (re)compiled the trunk source with:
gradlew clean, gradlew build, gradlew distZip
I then launched the unzipped dist file with a OmegaT.bat with
java -jar -Xmx1024M -Duser.language=en -Dgoogle.api.key=MYAPIKEY "%~dp0OmegaT.jar" %*
the error is the same as above.
I have not got a special premium key from google, but the the old api should work if the new one fails for any reason.
You are right, the API should fallback to the old engine if the request fails. However, we are currently using GET method to fetch the results from Google, and according to the API documentation:
So currently, you should activate the premium engine only if your account is allowed to.
Implemented in the released version 4.1.1 of OmegaT.
Didier
Last edit: Didier Briel 2017-03-16