我想从文本中提取关键字,然后根据其权重绘制一个网络。我在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
以前它曾经可以正常工作,请任何人告诉我我错了。谢谢
答案 0 :(得分:0)
为什么不同时使用textrank(https://CRAN.R-project.org/package=textrank)R包和udpipe R包(https://CRAN.R-project.org/package=udpipe)
这两个软件包的插图中的示例准确显示了您要完成的工作。