0

我已经通过 rJAVA、NLP、openNLP、coreNLP 包使用了 coreNLP 包和 stanford Parser

这是我的代码

sent_token_annotator <- Maxent_Sent_Token_Annotator()
word_token_annotator <- Maxent_Word_Token_Annotator()
parse_annotator <- Parse_Annotator()
initCoreNLP(mem = "8g", annotators = c("tokenize", "ssplit","pos","lemma"))

在昨天,一切都在工作,

但是今天,它突然不工作了。显示:

initCoreNLP 错误(mem = "8g", annotators = c("tokenize", "ssplit", : 未使用的参数 (annotators = c("tokenize", "ssplit", "pos", "lemma"))

在我的代码中,前 3 行成功运行,但最后一行出错

我试图检查内存(CPU i5:ram:8gb),重新安装 R&R studio。

此外,其他计算机中的相同代码,也出现了错误。代码中有错误吗?还是 NLP 服务器中的一些错误?我无法解决这个问题。我该如何解决?

4

2 回答 2

0

面临同样的问题......根据版本(https://cran.r-project.org/web/packages/coreNLP/coreNLP.pdf),不再有参数注释器。语法是

initCoreNLP(libLoc, type = c("english", "english_all", "english_fast",
"arabic", "chinese", "french", "german", "spanish"), parameterFile = NULL,
mem = "4g")

您必须使用以下命令,该命令将起作用,但会初始化所有注释器(包括很多您不会使用的会消耗大量内存的注释器(如 coref))。

initCoreNLP(mem = "8g")

要继续使用旧版本,您必须卸载 coreNLP 并使用 devtools 再次安装它,并明确提及安装版本 0.4-1(而不是当前版本 0.4-2)。之后,您可以使用与以前相同的命令:

library(devtools)
install_version("coreNLP", version = "0.4-1", repos = "http://cran.rproject.org")
initCoreNLP(mem="8g", annotators = c("tokenize", "ssplit","pos","lemma"))
于 2016-11-24T08:14:53.757 回答
0

you can change the annotators directly in the StanfordCoreNLP.properties file in the package. This worked for me.

于 2017-09-21T15:39:58.580 回答