Okapi mmt connector

Issue #650 resolved
Leon Tiberiu Cristian created an issue

I try to translate a text with tikal, but I am not sure the syntax is ok, I receive the following error message: F:!Ahk\okapi-apps_win32-x86_64_0.34>tikal -sl de -tl ro -q "fahrzeug" -mmt http ://192.168.0.110:8045 -context fahrzeug -trace


Okapi Tikal - Localization Toolset Version: 2.0.34


java.lang.ClassCastException: net.sf.okapi.connectors.mmt.MMTConnector cannot be cast to net.sf.okapi.lib.translation.ITMQuery at net.sf.okapi.applications.tikal.Main.setTMOptionsIfPossible(Main.java :1677) at net.sf.okapi.applications.tikal.Main.processQuery(Main.java:1637) at net.sf.okapi.applications.tikal.Main.main(Main.java:670)

Comments (7)

  1. YvesS
    • changed milestone to M35
    • assigned issue to
      YvesS

    There is a bug: We try to assign a threshold and a maximum number of hits options, while the connector does not supports such options.

    Same issue with the Lingo24Connector class.

  2. Leon Tiberiu Cristian reporter

    Hi, at first thank you for the work you all put in this project With the latest snapshot it works! Commmand F:!Ahk\okapi-apps_win32-x86_64_0.35-SNAPSHOT>tikal -sl de -tl ro -q "Sägeblatt" -mmt http://192.168.0.110:8045 -context "dero" -oe UTF-8 -ie UTF-8 -trace >t.txt Gets me this file:


    Okapi Tikal - Localization Toolset Version: 2.0.35-SNAPSHOT


    Trace: ProxySelector Request for http://192.168.0.110:8045/translate?q=S%C3%A4geblatt&context=-context Trace: Proxy used: DIRECT Trace: sun.net.www.MessageHeader@4459eb145 pairs: {GET /translate?q=S%C3%A4geblatt&context=-context HTTP/1.1: null}{User-Agent: Java/1.8.0_65}{Host: 192.168.0.110:8045}{Accept: text/html, image/gif, image/jpeg, ; q=.2, /*; q=.2}{Connection: keep-alive} Trace: KeepAlive stream used: http://192.168.0.110:8045/translate?q=S%C3%A4geblatt&context=-context Trace: sun.net.www.MessageHeader@5a2e45535 pairs: {null: HTTP/1.1 200 OK}{Date: Fri, 03 Nov 2017 07:18:01 GMT}{Content-Type: application/json; charset=utf-8}{Content-Length: 139}{Server: Jetty(9.3.z-SNAPSHOT)}

    = From net.sf.okapi.connectors.mmt.MMTConnector (de->ro) score: 95, origin: 'ModernMT API Connector' (from MT) Source: "S„geblatt" Target: "Pƒnz? de fer?str?u"

    I work under Windows 7, the request url is urlencoded nicely, but I have problems with the special chars, both in German and Romanian. This is maybe not a bug, but related to Windows cli. Is there a fix or maybe a workaround? I tried the oe and ie flags, but still the special chars are not displayed correctly. chcp 65001 & tikal -sl de -tl ro -q "Sägeblatt" -mmt http://192.168.0.110:8045 -context "dero" -oe UTF-8 -ie UTF-8 -trace does not help either.

    As stated before, the MMT connector works now in Tikal, however, it complains about the context flag, when, for instance, the -context is after oe and ie, when before, it works. -context "dero" -oe UTF-8 -ie UTF-8 - working -oe UTF-8 -ie UTF-8 -context "dero" - not working

    F:!Ahk\okapi-apps_win32-x86_64_0.35-SNAPSHOT>tikal -sl de -tl ro -q "sägen" -mmt http://192.168.0.110:8045 -oe UTF-8 -ie UTF-8 -context dero -trace

    Okapi Tikal - Localization Toolset Version: 2.0.35-SNAPSHOT


    java.security.InvalidParameterException: Invalid command-line argument '-context '. at net.sf.okapi.applications.tikal.Main.main(Main.java:633)

  3. YvesS

    Those are two distinct issues:

    First the problem with extended characters not being displayed correctly: This is independent from the connector and a general DOS issue. You may be able to fix this by specifying the encoding used to display the output on screen. See http://okapiframework.org/wiki/index.php?title=Tikal_-_Usage#Display_Encoding for the details on that.

    Then the problem with context: There was another bug in the way Tikal was trying to grab the context parameter. That should be fixed now (latest manual snapshot is here: http://okapiframework.org/snapshots/). But you are also not setting the parameter properly: both the URL and the context come just after the -mmt option (there is no -context option). The proper command line should be:

    tikal -sl de -tl ro -q "sägen" -mmt http://192.168.0.110:8045 dero -oe UTF-8 -ie UTF-8 -trace
    

    not

    tikal -sl de -tl ro -q "sägen" -mmt http://192.168.0.110:8045 -oe UTF-8 -ie UTF-8 -context dero -trace
    

    Hopefully the latest snapshot should now work as expected.

  4. Leon Tiberiu Cristian reporter

    Than you very much for your help and input, much appreciated! I solved the problem with the unicode characters, also by adding @chcp 65001 to the tikal.bat file.

  5. Log in to comment