Lttoolbox-java

From Apertium
Revision as of 15:38, 30 March 2009 by Jacob Nordfalk (talk | contribs)
Jump to navigation Jump to search

Notes (yes, I know its a mess... perhaps I will clean up later, or someone will be so kind to do it for me :-) Jacob Nordfalk 10:29, 30 March 2009 (UTC)

Nic Cottrell contributed a Java port of lttoolbox but it needs work to finish it.

What is lttoolbox

<jacobEo> Rah2: lttoolbox are making binary files out of the .dix files.
<jacobEo> Rah2: lttoolbox-java needs to at least be able to _read_ these binary files.
<jacobEo> Rah2: Pls compile lttoolbox and apertium and a language pair of your choice.
<jacobEo> Rah2: Then much more will be clear

Download preferably via SVN. It it fails:

<jacobEo> http://apertium.svn.sourceforge.net/viewvc/apertium/trunk/lttoolbox/
<jacobEo> http://apertium.svn.sourceforge.net/viewvc/apertium/trunk/apertium-tools/lttoolbox-java/
<jacobEo> "Download GNU tarball" will give a compressed archive

Required

  • Binary compatibility with lttoolbox (input and output files should be the same)
  • a test suite which runs on both lttoolbox (C++) and lttoolbox-java


Problems

  • Right now we have a line-for-line port of the C++ code of lttoolbox in apertium-tools/lttoolbox-java. It's NOT working.
  • it's amost line for line identical to the C++, aside from Java/C++ differences.

But the languages are different. C++ for example has some methods where some simple type variables are changed (the reference is passed) But in Java simple type variables can only be passed by value, and thus the caller's value is not changes. That sort of things needs to be sorted out.

  • The biggest problem is the XML handling: The C code's library callback calls a method in the code both when it meets a START and an END tag (for C++, we use libxml2).
    • The Java's XML library only calls the callback method at the START tag.
    • Perhaps we could find another Java XML library that could be made also call for the end tags. Or some kind of wrapper-inbetween thing could be made. Or you could use SAX and make your own callback thing.
  • There might be other problems. The project just got stranded on the XML parse part.


Other notes

You don't need much knowlede of MT or NLP to do lttoolbox-java. But you need to know C++ and Java and be able to debug both. You only have to understand what lt-expand, lt-comp and lt-proc does with a .dix file

<Drew_> jacobEo: I can't find a main class in the source code, am I looking in the wrong place? :S
<jacobEo> Drew_: LTComp.java, LTExpand.java, LTProc.java