Reputation: 65
I am encountering the error Error in py_call_impl(callable, dots$args, dots$keywords) : RuntimeError: index_select(): Expected dtype int64 for index
when I try to run corenlp on longer strings of text (this is what I think triggered the issue) via CleanNLP in R.
library(reticulate)
Sys.setenv(RETICULATE_PYTHON = 'C:/Users/myname/AppData/Local/r-miniconda/envs/r-reticulate')
py_discover_config(required_module="cleannlp")
# Initialise model
cnlp_init_corenlp()
Running it on this sample text tibble works:
justtext <- tibble(
id = 1:3,
text = c("Let me be the one you call.
If you jump, I'll break your fall.",
"Let me be the one you call.
If you jump, I'll break your fall.",
"Let me be the one you call. If you jump, I'll break your fall.")
)
cnlp_annotate(justtext)
However, I encounter the issue when I lengthen a string of text, like so:
justtext <- tibble(
id = 1:3,
text = c("Let me be the one you call.
If you jump, I'll break your fall.",
"Let me be the one you call.
If you jump, I'll break your fall.",
"Let me be the one you call. If you jump, I'll break your fall the quick brown fox jumped over the lazy dog.")
)
cnlp_annotate(justtext)
Error in py_call_impl(callable, dots$args, dots$keywords) : RuntimeError: index_select(): Expected dtype int64 for index
How can I get around this? The texts I want to process are each of a much longer length than one short sentence.
Upvotes: 2
Views: 3936
Reputation: 6168
This could probably be happening because stanfordnlp
is outdated and not maintained.
It is an known issue in its Github issues https://github.com/stanfordnlp/stanfordnlp/issues/6
Upvotes: 1