我是使用R coreNLP软件包的新手。我刚刚安装了该软件包,目的是使用功能getOpenIE。但是,即使我在一个非常简单的句子上运行代码。annotateString函数也不能用于注释openie。请参见以下代码:
library(coreNLP)
downloadCoreNLP()
initCoreNLP()
text <- "food is good and staff is friendly"
t <- annotateString(text)
> t$openie
NULL
> getOpenIE(t)
NULL
这是常见问题吗?有人找到解决方案了吗?谢谢
答案 0 :(得分:0)
我也遇到了麻烦。使用type = "english_all"
函数时需要添加initCoreNLP
。请在下面查看有效的reprex:
library(coreNLP)
#> Warning: package 'coreNLP' was built under R version 3.4.4
downloadCoreNLP()
#> [1] 0
initCoreNLP(type = "english_all")
text <- "food is good and staff is friendly"
t <- annotateString(text)
t$openie
#> subject_start subject_end subject relation_start relation_end relation
#> 1 4 5 staff 5 6 is
#> 2 0 1 food 1 2 is
#> object_start object_end object
#> 1 6 7 friendly
#> 2 2 3 good
getOpenIE(t)
#> subject_start subject_end subject relation_start relation_end relation
#> 1 4 5 staff 5 6 is
#> 2 0 1 food 1 2 is
#> object_start object_end object
#> 1 6 7 friendly
#> 2 2 3 good
由reprex package(v0.2.1)于2018-12-29创建