[SRILM User List] Did the network protocol change in srilm 1.7?
stolcke at icsi.berkeley.edu
Fri Jan 25 08:17:52 PST 2013
On 1/25/2013 1:33 AM, Lars Jørgen Solberg wrote:
> It works like a charm. Thanks!
Glad to hear it. Please be aware that there is a limit to the string
length of the message the server will process.
This is the constant REMOTELM_MAXREQUESTLEN in lm/src/RemoteLM.h
> On 25. jan. 2013 09:21, Andreas Stolcke wrote:
>> On 1/24/2013 7:34 AM, Lars Jørgen Solberg wrote:
>>> I have a project where I use the server functionality in srilm,
>>> which worked fine until i upgraded to version 1.7.
>>> What I do can be outlined as (code snippets are in python):
>>> 1 launch a server
>>> $ ngram -server-port 5000 ...
>>> 2 connect to the server
>>> conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> conn.connect(("localhost", 5000))
>>> 3 send a bunch of ngrams separated by newlines
>>> conn.sendall('A A A\nB B B\nC C C\n')
>>> 4 recieve the probabilites
>>> reply = conn.recv(4096)
>>> This works fine in version 1.6, but in 1.7 the reply only contains
>>> one probability.
>> The very first code implementing the LM server used stdio library
>> calls to receive/send data over the network socket.
>> This happened to allow the behavior you want, but was never intended
>> (or documented). It is also not portable (e.g., to Windows sockets).
>> When the code was rewritten (before 1.7, actually) to use recv/send
>> system calls this no longer worked.
>> However, I see why you would want to send batches of requests, so
>> this seems like a useful thing to support.
>> I modified the code to do this, and the patch is attached. Please let
>> me know how it works for you.
More information about the SRILM-User