Wiki

Clone wiki

nadaparser / Download

Download


At the moment when I am writting this wiki page there is no pre-built version of this application except Java source. The only way of using this application is by compiling yourself the source code.

Note: all the file names/paths in this document are written using the Unix filesystem style

Required tools/libraries


In order to be able to use this application you have download the source code and compile it. Therefore you need the following tools:

Installing and running


To get the application running on your system, the first thing you must do is to build the application from sources, resulting an Java JAR archive file that represents the program.

Once you have got it all you have to do is to run it like :

java -jar <your-jar-file>

Build by Eclipse IDE


If you are an Java developer and you are already using the Eclipse IDE then the installing process should be smooth.

  1. Open the Eclipse project from the nadaparser source folder.
  2. Right-click on nadaparser project then Properties -> Java Build Path -> Libraries -> Add External JARs, and choose the sqlite4java.jar, nekohtml.jar, xercesMinimal.jar, commons-logging-1.1.1.jar, httpclient-4.1.2.jar and httpcore-4.1.2.jar that you have previously downloaded (it's a project requirement, remember?).
  3. Compile the nadaparser project.
  4. Export the JAR: File -> Export -> Runnable JAR file and enter the Export destination as /tmp/nadaparser.jar and check Package required libraries into generated JAR then press Finish
  5. Run the application from where you have exported, like: java -jar /tmp/nadaparser.jar

Build by hand


If you are little more adventurous and you like the freedom that the command line gives you then you could try to compile everything just using your preffered JDK toolkit. Open your terminal, and follow the instructions bellow:

  1. cd <nadaparser-directory>
  2. javac -sourcepath src/ -g:none -classpath <path-to-sqlite4java>/sqlite4java.jar:<path-to-nekohtml>/nekohtml.jar:<path-to-xerces>/xercesMinimal.jar:<appache-lib>/commons-logging-1.1.1.jar:<appache-lib>/httpclient-4.1.2.jar:<appache-lib>/httpcore-4.1.2.jar -d target/classes src/*.java
  3. cd target/classes
  4. jar xf <path-to-sqlite4java>/sqlite4java.jar com javolution
  5. jar xf <path-to-nekohtml>/nekohtml.jar org
  6. jar xf <path-to-xerces>/xercesMinimal.jar org
  7. jar xf <appache-lib>/commons-logging-1.1.1.jar org
  8. jar xf <appache-lib>/httpclient-4.1.2.jar org
  9. jar xf <appache-lib>/httpcore-4.1.2.jar org
  10. echo -e "Main-Class: Main\nClass-Path: com.almworks.sqlite4java.SQLite org.cyberneko.html.parsers.DOMParser javax.xml.parsers.* org.apache.http.* org.w3c.dom.* org.xml.sax.SAXException" > /tmp/Manifest.txt
  11. jar cfm /tmp/nadaparser.jar /tmp/Manifest.txt *.class com javolution org

At this point you have your /tmp/nadaparser.jar which in fact is the nadaparser application packaged into a ZIP file (with .jar extension).

The next step is to run the .jar to get your job done.

Run nadaparser


If you will run the command: java -jar /tmp/nadaparser.jar -h you will get an output like the following:

NadaParser v1.1-rc-0-g8b04692 (2012-05-18)
For each word in the source database send a request to lexin2.nada.kth.se server and creates a SQLite dictionary with that data

Usage: java Main [-options]
where options include:
  -f,  --from=<value>    ; (mandatory) source locale ID, see -l option (column LocID)
  -t,  --to=<value>      ; (mandatory) destination locale ID, see -l option (column LocID)
  -i,  --input=<value>   ; (mandatory) the input SQLite database file where <source lang> can be found
  -o,  --output=<value>  ; (mandatory) the output SQLite database file that will be created for <dest. lang>
  -v,  --verbose         ; (optional) output the progress status to screen
  -w,  --wait=<value>    ; (optional) number of miliseconds to wait between two consecutive HTTP requests (default 5000 ms)
  -r,  --resume          ; (optional) resume an aborted session from the last word where it had remained
  -l,  --list            ; (optional) don't run the real task, just list the available locales supported by Java then exit
  -q,  --quiet           ; (optional) be quiet, no kind of verbosity
  -h,  --help            ; (optional) show this help

Report bugs to <eugenmihailescux@gmail.com>

As you can see there are 4 mandatory arguments:

  • -f, --from : the source locale ID corresponding to the dictionary specified by --input argument
  • -t, --to : the target locale ID corresponding to the dictionary specified by --output argument
  • -i, --input : a source XML dictionary in SQLite format (see lexicon2sqlite)
  • -o, --output : the output file where the translated database will be saved
Note : You can first run the application with the --list argument to get the valid locale ID list then re-run the application with the mandatory arguments.

Updated