Java Examples

This directory contains a few examples on how to use the Okapi library with your own Java programs.

The examples have been pre-compiled. You can execute them by running run_examples.bat (Windows) or run_examples.sh (Linux and Macintosh).

Make sure to have the examples in a directory where you have write-rights.

If you wish to modify and re-compile the examples:

Example01

This example shows how to create and execute a pipeline with three or four steps:

You can choose to run both middle steps or just one of them from the command-line option.

Example02

This example takes a properties file or an OpenOffice.org document and print to the console all translatable text. The inline codes inside the text are displayed with generic markers such as: <1>...</1>, <2/>.

Example03

This example takes a file test.xml (complied into the jar, but you can see it in the src directory) and runs a pipeline with four steps:

Example04

This example shows some of the functionality provided by the segmenter included in the Okapi Library. It uses the myRules.srx SRX file included in the sample files to segment some example text.

Example05

This example shows how to use some of the TM and MT query connectors that are provided with the Okapi Library. The first part demonstrates the Apertium MT server. The second part shows how to query the Amagama TM server. Both have public servers that should be accessible to everyone running the demo.