Hi Raymond

On Thu, Sep 29, 2016 at 12:07 AM, Raymond Monette <[email protected]>
wrote:

> “This can be launched using the same command-line arguments as moses, with
> two additional arguments to specify the listening port and log-file (
> --server-port and --server-log). These default to 8080 and /dev/null
> respectively.”
>
>
>
> Would it be possible to get a full command line example please? Or
> something that illustrates/confirms that the “as a service” component
> runs/works. I tried this, but Im sure Im not getting something.
>
> mosesdecoder/bin/moses -f phrase-model/moses.ini < phrase-model/in > out 
> --server-port
> 8080  --server-log /dev/null
>

To start a Moses server you can either use the "mosesserver" binary which
by now is nothing more than an empty wrapper for "moses":

*$ mosesserver -f /path/to/moses.ini*

or start the "usual" Moses with the "--server" option:

*$ moses --server -f /path/to/moses.ini*

Port 8080 might already be in use, in which case you have to run the server
on another port.

And here is how to find out whether the server works: first of all, if it
outputs "Listening on port 12345" at the end of startup, then usually this
means the server is working. Testing translations is not done from the
command line, because the point of using Mosesserver is that clients
request translations with XML-RPC. You test it by writing a few lines of
code in your favourite programming language that, preferably,  has an
XML-RPC library.

In Python, for example, the code could look like


*# the Python implementation of XML-RPC*


*import xmlrpclib*

*# if the client is on the same machine and the --server-port is 12345*


*url = 'http://localhost:12345/RPC2 <http://localhost:12345/RPC2>'*

*# verbose prints the actual XML-RPC request and answer, have a look*

*server = xmlrpclib.ServerProxy(url, verbose=True)*

*# request the translation of a single sentence*
*server.translate({"text": "das ist ein kleines haus")*

Regards
Mathias

—

Mathias Müller
AND-2-20
Institute of Computational Linguistics
University of Zurich
+41 44 635 75 81
[email protected]






> I haven’t tried the perl client script yet. Id eventually like to invoke
> maas via a web service, which I can build pretty easily on the Windows
> side.
>
>
>
> On a side note: Id like to contribute if possible… Im pretty decent and
> verbose when it comes to documenting stuff, but am not a Linux expert. If
> someone is willing to review my stuff I could send some docs. So far, Ive
> just documented stuff for Ubuntu 16.04… The challenge for me was
> understanding where things are supposed to go (ie root folders for
> installations, etc…)
>
>
>
> Any clarifications would be appreciated.
>
>
>
> Thanks
>
> R
>
> _______________________________________________
> Moses-support mailing list
> [email protected]
> http://mailman.mit.edu/mailman/listinfo/moses-support
>
>
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to