This is my first attempt as using stackoverflow and I am also still very new to R, so I apologise if I screw up any formatting.
I am currently trying to get the entity recognition commands to work in the openNLP package. using their provided examples, however I am still getting an error. please see the code below
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))
which returns as error:
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())
Please help me, I am so confused, as I ran it last thursday and it seemed to work, however now it doesnt. Thank you, any help is appreciated.
It worked for me when I removed/unchecked ggplot2 from the library.