我让终端使用SenseRelate::AllWords,使用以下命令:
wsd.pl --context test.txt --format raw --但是,现在我正试图从我的wsd.pl代码中运行,它看起来如下:
public static void main(String args[] ) throws IOException {
String line;
ProcessBuilder pb = new ProcessBuilder("wsd.pl", "--context test.txt", "--format raw");
pb.redirectErrorStream(true);
Process process = pb.start();
InputStream stdout = process.getInputStream();
BufferedReader reader = new BufferedReader (new InputStreamReader(stdout));
while ((line = reader.readLine ()) != null) {
System.out.println ("Stdout: " + line);
}
}它给我带来了错误:
Stdout: Unknown option: context test.txt
Stdout: Unknown option: format rawtest.txt路径指向项目的源文件夹(顶级、src、.git等)
我尝试过一些不同的方法:向列表中添加参数,并基于该列表创建一个新的进程,不同的参数格式化方法,但不,它不能工作。有人能帮忙吗?我想这是一些我不熟悉的语法。
谢谢!
发布于 2013-11-26 12:52:49
ProcessBuilder pb = new ProcessBuilder("wsd.pl", "--context", "test.txt", "--format", "raw");还要确保您的工作目录是正确的。
https://stackoverflow.com/questions/20217419
复制相似问题