Wednesday, January 20, 2010

How to set the locale environment variables under Linux

The locale environment variables can affect the encoding of Java applications.
Thus, sometimes if you do not set the variables correctly, you can't run your Java applications.

You can run command "locale" to display all the locale environment variables of current shell:
$ locale
LANG=en_US.utf8
LC_CTYPE=de_DE.utf8
LC_NUMERIC=de_DE.utf8
LC_TIME=de_DE.utf8
LC_COLLATE=de_DE.utf8
LC_MONETARY=de_DE.utf8
LC_MESSAGES=en_US.utf8
LC_PAPER=de_DE.utf8
LC_NAME=de_DE.utf8
LC_ADDRESS=de_DE.utf8
LC_TELEPHONE=de_DE.utf8
LC_MEASUREMENT=de_DE.utf8
LC_IDENTIFICATION=en_US.utf8
LC_ALL=


You can see all the supported locale settings using:
$locale -a

The setting of LC_CTYPE seems to be decisive over all other variables except for LC_ALL. Setting LC_ALL overrides any other locale variable.

Sunday, January 3, 2010

How to use the internal language model of moses on Windows

the Internal LM is meant to mimic SRILM,
and you need to use SRILM to train your language model under Linux first,
and then copy the trained language model files to Windows.

You also need to copy all the translation models, including phrase table, reordering model to Windows, and of course changing the moses ini file is needed, because the path names are different.

On Windows, you can use language models which are up to trigram.
Although the windows version of moses can run with 4-gram or higher language models,
but the translation results are incorrect.

Saturday, January 2, 2010

How to compile moses under Visual Studio 2005

Moses can be compiled under Visual Studio 2005.
Fortunately, moses provides all the necessary files for you including solution and project files.

However, you also need to download some source files and library files as described in:
http://www.statmt.org/moses/?n=Moses.LibrariesUsed

For me, I need to download VLD and zlib. They are both pre-compiled version, and what you need to do is to add the directories to your moses solution under Visual Studion 2005.

When you first open the solution of moses, you will see four projects as follows:


After that you need to download VLD and zlib, and I put the two downloaded folders under the solution directory of moses as follows:


For the project "moses", you need to add "Additional Include Directories" in the property of the project:


and you also need to add "Additional Library Diretories":



For the other three projects, you need to add "Additional Include Directories" and "Additional Dependencies" as follows:






Finally, you did it, and you can compile the whole solution now.