我stanford-corenlp-full-2018-02-27
从下载页面下载了 stanfordCoreNLP 模块版本并解压了文件。在解压缩的目录中创建了一个 example_file.txt 文件。我添加了文本My name is Sam. I want to be an astronaut. I had snacks a while ago.
。我导航到它被提取到的文件夹,并尝试在命令行中运行为共同引用解析给出的示例代码
java -Xmx5g -cp stanford-corenlp-3.9.1.jar:stanford-corenlp-3.9.1-sources.jar:* edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,mention,coref -coref.algorithm neural -file example_file.txt
我收到以下错误消息
Exception in thread "main" java.lang.IllegalArgumentException: File doesn't exist: example_file.txt
at edu.stanford.nlp.io.FileSequentialCollection$FileSequentialCollectionIterator.primeNextFile(FileSequentialCollection.java:364)
at edu.stanford.nlp.io.FileSequentialCollection$FileSequentialCollectionIterator.<init>(FileSequentialCollection.java:269)
at edu.stanford.nlp.io.FileSequentialCollection.iterator(FileSequentialCollection.java:238)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:1166)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.processFiles(StanfordCoreNLP.java:1010)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.run(StanfordCoreNLP.java:1365)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1427)
这有什么帮助吗?
使用-cp
选项定义的类路径中的 Java 查找资源。包含的目录example_file.txt
可能应该包含在其中
-cp ".:stanford-corenlp-3.9.1.jar:stanford-corenlp-3.9.1-sources.jar:*"
添加到类路径的点意味着this directory
它显然包含您的文件。此外,双引号可防止 shell 在末尾扩展通配符,在我看来,除非它包含与应用程序相关的 jars,否则它不应该存在。最多,可能是*.jar
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句