The Moses server enables you to run the decoder as a server process, and send it sentences to be translated via XMLRPC. This means that one Moses process can service distributed clients coded in Java, perl, python, php, or any of the many other languages which have XMLRPC libraries.
To build the Moses server, you need to have XMLRPC-c installed and you need to add the argument
--with-xmlrpc-c=<path-xmlrpc-c-config> to the configure arguments. It has been tested with the latest stable version, 1.33.17. You will also need to configure Moses for multi-threaded operation, as described above.
Compiling with xmlrpc-c library will create the moses executable that has a few extra arguments. To use it as a server, add the arggument
--server. Use other arguments to specify the listening port and log-file (
--server-log). These default to 8080 and
A sample client is included in the
server directory (in perl), which requires the
SOAP::Lite perl module installed. To access the Moses server, an XMLRPC request should be sent to
http://host:port/RPC2 where the parameter is a map containing the keys
text and (optionally)
align. The value of the first of these parameters is the text to be translated and the second, if present, causes alignment information to be returned to the client. The client will receive a map containing the same two keys, where the value associated with the
text key is the translated text, and the
align key (if present) maps to a list of maps. The alignment gives the segmentation in target order, with each list element specifying the target start position (
tgt-start), source start position (
src-start) and source end position (
Note that although the Moses server needs to be built against multi-threaded moses, it can be run in single-threaded mode using the
--serial option. This enables it to be used with non-threadsafe libraries such as (currently) irstlm.
A proposed standard for machine translation APIs has been developed as part of the MosesCore project (European Commission Grant Number 288487 under the 7th Framework Programme). It is called Open Machine Translation Core (OMTC) and defines a service interface for MT interfaces. This approach allows software engineers to wrap disparate MT back-ends such that they look identical to others no matter which flavour of MT system is being wrapped. This provides a standard protocol for “talking” to MT back-ends. In applications where many MT back-ends are to be used, OMTC allows for easier integration of these back-ends. Even in applications where one MT back-end is used, OMTC provides highly cohesive, yet low coupled, interfaces that should allow the back-end to be replaced by another with little effort.
OMTC standardises the follow aspects of an MT system:
A reference implementation of OMTC has been constructed in Java v1.7. It is available in the
contrib/omtc directory of the
mosesdecoder as a Git submodule. Please see the
contrib/omtc/README for details.