Menu

#1389 Watson Language Translator Integration

4.1
closed-fixed
5
2019-07-24
2018-05-31
No

Discussion

  • Briac Pilpré

    Briac Pilpré - 2018-06-01

    This has been integrated in revision [r10394].

     

    Related

    Commit: [r10394]


    Last edit: Aaron Madlon-Kay 2018-06-01
  • Briac Pilpré

    Briac Pilpré - 2018-06-01
    • status: open --> open-fixed
     
  • Aaron Madlon-Kay

    • assigned_to: Briac Pilpré
     
  • Fabio M Caldas

    Fabio M Caldas - 2018-06-02

    Thank you very much!

     
  • Didier Briel

    Didier Briel - 2018-06-08
    • status: open-fixed --> closed-fixed
     
  • Didier Briel

    Didier Briel - 2018-06-08

    Closed in the released version 4.1.5 of OmegaT.

    Didier

     
  • xq

    xq - 2018-06-21

    Hi, Briac,

    Do you have any plan to add an option about "customised model"?

    In tutorial, after customised model created, traslation could be made specifying "modelID" of the customised model.

    Could I add this "modelID" parameter by amending "IBMWatsonTranslate.java"?
    Some where like

    +
    
    +        params.put("text", trText);
    +        params.put("source", sLang.getLanguageCode().toUpperCase());
    +        params.put("target", tLang.getLanguageCode().toUpperCase());
    
     

    Last edit: xq 2018-06-21
    • Briac Pilpré

      Briac Pilpré - 2018-06-21

      I updated the Watson MT to use the v3 API (https://console.bluemix.net/docs/services/language-translator/migrating.html, https://www.ibm.com/watson/developercloud/language-translator/api/v3/curl.html?curl).
      Also, it's now possible to set a Model Id in the MT configuration panel.

       
  • TanakaHiroyuki

    TanakaHiroyuki - 2018-07-11

    Hi!

    Many thanks for the great integration!

    Can someone please tell me how to specify a usename and password for Watson Language Translator in the OmegaT [Preferences] - [Machine Translation] - [IBM Watson] - [Configure] dialog?
    I managed to find out the Language Translator service credentials in IBM Cloud but there are no [Username] or [Password] in the credentials. The credentials only show values of [apikey], [iam_apikey_description], [iam_apikey_name], [iam_role_crn], [iam_serviceid_crn] and [url]. Where can I find my username and password that can be used with OmegaT? Please help me!

    Tanaka

     

    Last edit: TanakaHiroyuki 2018-07-11
  • TanakaHiroyuki

    TanakaHiroyuki - 2018-07-12

    Hi, xq

    Thanks for your help but I still can not figure out witch infomation is needed to work with OmegaT.

    My API credentials look like below:

    {
    "apikey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:language-translator:us-south:a/858d620dcbe749cba14b78b41b126890:9fb4e502-70d0-30c7-b197-0e326a3ecbad::",
    "iam_apikey_name": "auto-generated-apikey-db53e667-2f12-4da5-abc7-69c2b906f0c2",
    "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager",
    "iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/858d620dcbe749cba14b78b41b126890::serviceid:ServiceId-a543e408-e839-4dcd-80cf-9e40046fd7c3",
    "url": "https://gateway.watsonplatform.net/language-translator/api"
    }

    Which one is the username and which is the password?

    Please help me.

     
    • xq

      xq - 2018-07-12

      I am not sure whether the language translator can be implemented with "IAM tokens" or not.
      Sadly, I am just starting to use "watson platform".

      I think you could find "Service credentials" by clicking the service instance on the Dashboard
      Find more info. HERE

      Service credentials should be like:
      {
      "url": "https://gateway.watsonplatform.net/language-translator/api",
      "username": "••••••••••••••••••••••••••••••••••••",
      "password": "••••••••••••"
      }

       

      Last edit: xq 2018-07-12
      • TanakaHiroyuki

        TanakaHiroyuki - 2018-07-12

        Hi!

        I do not see any service credentials that has a username or password.
        The only service credential that I can see is the one that looks like in the attached picture.

        Maybe I am missing some settings in my IBM account.

         
  • dingar

    dingar - 2018-08-06

    I find the apikey only as well. There is no username and password.

     
    • xq

      xq - 2018-08-07

      I lost my username and password after resetting the Watson Language Translator. This issue might be related to the update of Language Translator API around July, 2018.

      API uses a new form

      curl -u "apikey:{apikey}" "https://gateway.watsonplatform.net/language-translator/api/{method}"
      

      Instead of "username and password"

      curl -u "{username}":"{password}" "https://gateway.watsonplatform.net/language-translator/api/{method}"
      

      how to resolve:
      It works, but looks ugly.
      The solution needs to edit the file /src/org/omegat/core/machinetranslators/IBMWatsonTranslate.java
      (1) Comment line 94-96

      //if (apiPassword == null || apiPassword.isEmpty() || apiLogin == null || //apiLogin.isEmpty()) {
      //            return OStrings.getString("IBMWATSON_API_KEY_NOTFOUND");
      //        }
      

      (2) Edit line 119 as below

       String authentication = "Basic " + Base64.getMimeEncoder().encodeToString((apiLogin).getBytes(StandardCharsets.ISO_8859_1));
      

      (3) Recompile Omegat
      (4) When setting the "username and password", put apikey:{apikey} in the textbox of username and leave the password empty.

      I hope this could help.

       

      Last edit: xq 2018-08-07
  • Kepler Lee

    Kepler Lee - 2018-08-07

    My OS is Win7, instead of Linux.

    Do you mean: we have to execute "curl" command to get username and password?

    If so, how to execute "curl"?

    If not, in Win7, where is "/src/org/omegat/core/machinetranslators/IBMWatsonTranslate.java" you mentioned?

    Thank you!

     
    • xq

      xq - 2018-08-09

      Do you mean: we have to execute "curl" command to get username and password?

      No, you don't need curl. It's just an example of forms of the API.

      where is "/src/org/omegat/core/machinetranslators/IBMWatsonTranslate.java" you mentioned?

      It could be found here.
      https://sourceforge.net/p/omegat/code/ci/master/tree/src/org/omegat/core/machinetranslators/IBMWatsonTranslate.java

      Actually, source code is need to be amended for this issue. However, the amendments, what I purposed, use an ugly way to detour this issue rather than sovle it.

      My OS is Win7, instead of Linux.

      OS seems like irrelevant.
      Further, you will need eclipse and gradle to compile the source code.

       
  • Kepler Lee

    Kepler Lee - 2018-08-09

    I understand that general OmegaT users cannot use IBM Watson currently if they do not have programming ability. Only when this issue is solved in future versions could we enjoy the benefit.
    It is unfortunate. Anyway, thank you for explanation.

     
  • Briac Pilpré

    Briac Pilpré - 2018-08-09

    The issue should be fixed in revision [r10453].
    Watson uses two mechanisms for authentication (login/password and api token) depending on the instance.
    If the instance you are using has an api_token, you should leave the password field empty.

    Also, I added a field in the configuration panel to set a custom URL if your instance doesn't use the standard one.

     

    Related

    Commit: [r10453]

    • TanakaHiroyuki

      TanakaHiroyuki - 2018-08-11

      Hi!

      I left the password field blank and entered only my api into the the [Username or API Key] field as you advised but still no luck, the Machine Translation window still shows 401:Unauthorized.

       

      Last edit: TanakaHiroyuki 2018-08-11
      • Andre

        Andre - 2019-07-16

        Hi, have you found theIBM Watson bug solved or a workaround to this problem? I seem to find a latter one that works.

         
        • Briac Pilpré

          Briac Pilpré - 2019-07-24

          Hello,
          This issue should be fixed in the current release (it is fixed since the version 4.1.5 update 4)

           
    • xq

      xq - 2018-08-24

      Hi, Briac
      Still learning on how to upload my code. Sorry for that.

      With update [r10453], there is one more bug left.

      The form "apikey:{apikey}" means the expression should be like apikey:AAABBBCCCDDDEEEFFF

      That is, we could add a line in line 103 of src/org/omegat/core/machinetranslators/IBMWatsonTranslate.java

        if (apiPassword == null || apiPassword.isEmpty()) {
                  apiPassword = apiLogin;
                  apiLogin = "apikey"; //added line here
              }
      

      And this could work well.

      Always, thank you very much!

       

      Related

      Commit: [r10453]

      • Briac Pilpré

        Briac Pilpré - 2018-08-24

        Thanks xq, apparently I read the API doc the wrong way! I added your fixed line in [r10455].

         

        Related

        Commit: [r10455]


Log in to post a comment.

MongoDB Logo MongoDB