[SRILM User List] Did the network protocol change in srilm 1.7?
Lars Jørgen Solberg
supersolberg at gmail.com
Fri Jan 25 01:33:52 PST 2013
It works like a charm. Thanks!
-ljs
On 25. jan. 2013 09:21, Andreas Stolcke wrote:
> On 1/24/2013 7:34 AM, Lars Jørgen Solberg wrote:
>> Hi
>>
>> 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.
>
> Andreas
>
--
The moth of wrath goads the rat on! The rat goes berserk!
More information about the SRILM-User
mailing list