开发者

Wordnet::Similarity server: how to talk to it from Java?

I installed the WordnetSimilarity server on my Ubuntu. I launch it with the command:

$ similarity_server.pl --logfile server.log

Now I want to use it from my Java/Groovy app, and I wrote this 开发者_StackOverflow中文版code to get the server version:

// open connection
Socket kkSocket = new Socket("localhost", 31134);
def out = new PrintWriter(kkSocket.getOutputStream(), true);
def inbuf = new BufferedReader(new InputStreamReader(kkSocket.getInputStream()));

out.write("v") // command for the server
out.write("\015\012") // end of message
out.flush()
// so far so good
println inbuf.readLine()
// no response, hanging...

Nothing happens, and the server log is empty. The server protocol is defined in here: http://search.cpan.org/~tpederse/WordNet-Similarity-2.05/utils/similarity_server.pl

The server is definitely running, because if I stop it, the socket allocation fails.

Any hint?

Cheers, Mulone


It looks like it should work. I suspect that there is a problem with the server. Some things to try:

  1. Are there any other clients you can use to see if the server is responding properly?
  2. Is there any "verbose" output option for the server?
  3. Is the server able to access whatever resources it needs, e.g., WordNet over an internet connection?
  4. Can you debug the server process?
  5. On the client, you can try reading one character at a time.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜