Wordnet::相似度服务器:如何从 Java 与其对话?
我在 Ubuntu 上安装了 WordnetSimilarity 服务器。 我使用以下命令启动它:
$ similarity_server.pl --logfile server.log
现在我想从我的 Java/Groovy 应用程序中使用它,我编写了以下代码来获取服务器版本:
// 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...
什么也没有发生,服务器日志为空。服务器协议在此处定义:http://search。 cpan.org/~tpederse/WordNet-Similarity-2.05/utils/similarity_server.pl
服务器肯定正在运行,因为如果我停止它,套接字分配失败。
有什么提示吗?
干杯,穆龙
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 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来应该可以。我怀疑服务器有问题。一些需要尝试的事情:
It looks like it should work. I suspect that there is a problem with the server. Some things to try: