【问题标题】:coreNLP- r package annotateString gives Null openiecoreNLP-r 包 annotateString 给 Null openie
【发布时间】:2018-08-09 21:33:23
【问题描述】:

我是使用 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

这是一个常见问题吗?有人找到解决方案了吗?谢谢

【问题讨论】:

    标签: r stanford-nlp


    【解决方案1】:

    我也遇到了麻烦。使用initCoreNLP函数时需要添加type = "english_all"。请参阅下面的工作代表:

    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 日创建

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 1970-01-01
      相关资源
      最近更新 更多