微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CleanNLP 中的 CoreNLP - 运行时错误“索引的预期 dtype int64”

如何解决CleanNLP 中的 CoreNLP - 运行时错误“索引的预期 dtype int64”

当我尝试通过 R 中的 CleanNLP 在较长的文本字符串上运行 corenlp 时遇到错误 Error in py_call_impl(callable,dots$args,dots$keywords) : RuntimeError: index_select(): Expected dtype int64 for index

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()

在此示例文本 tibble 上运行它:

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,"Let me be the one you call. If you jump,I'll break your fall.")
)
cnlp_annotate(justtext)

但是,当我延长一串文本时,我遇到了这个问题,如下所示:

justtext <- tibble(
  id = 1:3,I'll break your fall the quick brown fox jumped over the lazy dog.")
)
cnlp_annotate(justtext)
Error in py_call_impl(callable,dots$keywords) : RuntimeError: index_select(): Expected dtype int64 for index

我该如何解决这个问题?我要处理的文本比一个短句子要长得多。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。