openNLPdata中的R错误中的实体识别

这是我第一次尝试使用stackoverflow,而且我对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))

返回错误:

Error: Can't find `geom` called 'Pierre Vinken,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,the Dutch publishing group.'
Backtrace:
 1. ggplot2::annotate(s,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,the Dutch publishing group.'
Backtrace:
    x
 1. \-ggplot2::annotate(s,word_token_annotator))
 2.   \-ggplot2::layer(...)
 3.     \-ggplot2:::check_subclass(geom,env = parent.frame())

请帮助我,我很困惑,因为我上周四运行它,它似乎可以运行,但是现在不行了。 谢谢您的帮助。

kinshen911 回答:openNLPdata中的R错误中的实体识别

当我从库中删除/取消选中 ggplot2 时,它对我有用。

本文链接:https://www.f2er.com/2448712.html

大家都在问