openNLPdata中R错误中的实体识别

Entity Recognition in R error in openNLPdata

这是我第一次尝试使用 Whosebug,我对 R 还是很陌生,所以如果我搞砸了任何格式,我深表歉意。

我目前正在尝试让实体识别命令在 openNLP 包中工作。使用他们提供的示例,但是我仍然遇到错误。请看下面的代码

install.packages("rJava")
install.packages("openNLPmodels.en", repos = "http://datacube.wu.ac.at")

library(NLP)
library(rJava)
library(openNLP)
library(openNLPdata)


s <- paste(c("Pierre Vinken, 61 years old, will join the board as a ",
             "nonexecutive director Nov. 29.\n",
             "Mr. Vinken is chairman of Elsevier N.V., ",
             "the Dutch publishing group."),
           collapse = "")
s <- as.String(s)

## Need sentence and word token annotations.
sent_token_annotator <- Maxent_Sent_Token_Annotator()
word_token_annotator <- Maxent_Word_Token_Annotator()
a2 <- annotate(s, list(sent_token_annotator, word_token_annotator))

其中 returns 为错误:

Error: Can't find `geom` called 'Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29.
Mr. Vinken is chairman of Elsevier N.V., the Dutch publishing group.'
Run `rlang::last_error()` to see where the error occurred. ```

> rlang::last_error()
<error/rlang_error>
Can't find `geom` called 'Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29.
Mr. Vinken is chairman of Elsevier N.V., the Dutch publishing group.'
Backtrace:
 1. ggplot2::annotate(s, list(sent_token_annotator, word_token_annotator))
 2. ggplot2::layer(...)
 3. ggplot2:::check_subclass(geom, "Geom", env = parent.frame())
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/rlang_error>
Can't find `geom` called 'Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29.
Mr. Vinken is chairman of Elsevier N.V., the Dutch publishing group.'
Backtrace:
    x
 1. \-ggplot2::annotate(s, list(sent_token_annotator, word_token_annotator))
 2.   \-ggplot2::layer(...)
 3.     \-ggplot2:::check_subclass(geom, "Geom", env = parent.frame())

请帮助我,我很困惑,因为我 运行 上个星期四它似乎有效,但现在无效。 谢谢,任何帮助表示赞赏。

当我从图书馆 removed/unchecked ggplot2 时,它对我有用。