Menu

#1291 Additional parameter for neural net translation on Google translate

4.1
closed-fixed
None
5
2017-03-16
2016-12-10
Norgus
No

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"?

Related

Feature Requests: #1293

Discussion

  • Norgus

    Norgus - 2016-12-10

    For reference, I tried the following request URL manually and got the desired results.

    https://translation.googleapis.com/language/translate/v2?key=MY_API_KEY&source=ja&target=en&q=
    従来のある方法では、一体的に構成した電池モジュールを基台上に立設配置し、インバータと制御基板を電池モジュールに隣接して配置している(下記特許文献1参照)。&model=nmt
    

    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
  • Didier Briel

    Didier Briel - 2016-12-15

    See [#1293] for additional descriptions.

    Didier

     

    Related

    Feature Requests: #1293

  • Briac Pilpré

    Briac Pilpré - 2016-12-15

    I 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.

     
  • Didier Briel

    Didier Briel - 2017-01-01
    • status: open --> open-fixed
    • assigned_to: Briac Pilpré
    • Group: future --> 4.0
     
  • Didier Briel

    Didier Briel - 2017-01-01

    Implemented in SVN (/trunk).

    The "Premium" field is available in the Google MT dialog.

    Didier

     

    Last edit: Didier Briel 2017-01-02
  • Didier Briel

    Didier Briel - 2017-01-02

    There's also a command-line parameter: google.api.premium=true

    Didier

     
  • Briac Pilpré

    Briac Pilpré - 2017-01-03

    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.

     
    • Aaron Madlon-Kay

      In the future, please test to make sure it actually works before you commit to trunk.

       
  • Didier Briel

    Didier Briel - 2017-01-03
    • status: open-fixed --> open-accepted
     
  • Didier Briel

    Didier Briel - 2017-01-03

    I have reverted the status to "accepted" until you report success.

    Didier

     
  • Norgus

    Norgus - 2017-01-03

    I tried the most recent trunk build, and it does indeed appear to still be returning the translations from the old engine.

     
  • Didier Briel

    Didier Briel - 2017-01-13
    • status: open-accepted --> open-fixed
     
  • Didier Briel

    Didier Briel - 2017-01-13

    Implemented in /trunk.

    Google Premium now works as expected.

    Didier

     
  • rosros2000

    rosros2000 - 2017-02-03

    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>

     
  • rosros2000

    rosros2000 - 2017-02-03

    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.

     
  • Briac Pilpré

    Briac Pilpré - 2017-02-03

    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:

    Due to a known issue, GET requests that pass a model parameter for projects that have not yet been approved for use of the premium edition will error; POST requests will silently switch to use the standard edition and succeed.
    https://cloud.google.com/translate/docs/premium

    So currently, you should activate the premium engine only if your account is allowed to.

     
  • Didier Briel

    Didier Briel - 2017-03-16
    • status: open-fixed --> closed-fixed
    • Group: 4.0 --> 4.1
     
  • Didier Briel

    Didier Briel - 2017-03-16

    Implemented in the released version 4.1.1 of OmegaT.

    Didier

     

    Last edit: Didier Briel 2017-03-16

Log in to post a comment.

MongoDB Logo MongoDB