R,使用textrank进行键工作提取 - 错误ConstructTextGraph



我想从文本中提取关键字,然后根据其权重绘制一个网络。我在ConstructTextGraph上遇到错误:

library(NLP)
library(tm)
library(openNLP)
corp <- VCorpus(VectorSource(doc))
corp <- tm_map(corp, stripWhitespace)
corp <- tm_map(corp, tolower)
words_with_punctuation <- SplitText(as.character(corp[[1]]))
corp <- tm_map(corp, removePunctuation)
words <- SplitText(as.character(corp[[1]]))
tagged_text <- tagPOS(corp[[1]])
tagged_words <- SplitText(as.character(tagged_text))
tagged_words <- c(SelectTaggedWords(tagged_words,"/NN"),SelectTaggedWords(tagged_words,"/JJ"))  
tagged_words <- RemoveTags(tagged_words)                                                        
selected_words <- unique(tagged_words)                                                          
text_graph <- ConstructTextGraph(4)
Error in getClass(Class, where = topenv(parent.frame())) : 
“graphNEL” is not a defined class 

以前它工作正常,任何人都可以告诉我我错在哪里。谢谢

为什么不将 textrank (https://CRAN.R-project.org/package=textrank( R 包与 udpipe R 包一起使用 (https://CRAN.R-project.org/package=udpipe(

这两个软件包的小插图中的示例准确地显示了您要完成的任务。

最新更新