Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
词性标注;R中的主题/模式检测_R_Themes_Text Analysis_Pos Tagger - Fatal编程技术网

词性标注;R中的主题/模式检测

词性标注;R中的主题/模式检测,r,themes,text-analysis,pos-tagger,R,Themes,Text Analysis,Pos Tagger,我对R和探索文本挖掘还不熟悉。使用下面的步骤,我可以完成词干分析,但是,我需要做词性标记并获得文本/主题模式。我使用的数据是客户的逐字记录。请帮助如何进一步进行。我查阅的大多数文章都没有解释如何对语料库中的数据进行词性标注,我也找不到任何关于模式检测的细节。任何帮助都将不胜感激。。。!提前感谢, CSVfile = read.csv("Testfortextcsv.csv",stringsAsFactors = FALSE) TestSplit = as.data.frame(sent_dete

我对R和探索文本挖掘还不熟悉。使用下面的步骤,我可以完成词干分析,但是,我需要做词性标记并获得文本/主题模式。我使用的数据是客户的逐字记录。请帮助如何进一步进行。我查阅的大多数文章都没有解释如何对语料库中的数据进行词性标注,我也找不到任何关于模式检测的细节。任何帮助都将不胜感激。。。!提前感谢,

CSVfile = read.csv("Testfortextcsv.csv",stringsAsFactors = FALSE)
TestSplit = as.data.frame(sent_detect_nlp(CSVfile$Comment))
colnames(TestSplit)[colnames(TestSplit)=="sent_detect_nlp(CSVfile$Comment)"]<- "Comment"
TestCorpus = Corpus(VectorSource(TestSplit$Comment))
TestCorpus = tm_map(TestCorpus, tolower)
TestCorpus = tm_map(TestCorpus, PlainTextDocument)
TestCorpus = tm_map(TestCorpus, removePunctuation)
TestCorpus = tm_map(TestCorpus, removeWords,c("Test",stopwords("SMART"),stopwords("english")))
TestCorpus = tm_map(TestCorpus, stripWhitespace)
TestCorpus = tm_map(TestCorpus, stemDocument)
dtm <- TermDocumentMatrix(TestCorpus)
m <- as.matrix(dtm)
v <- sort(rowSums(m),decreasing=TRUE)
d <- data.frame(word = names(v),freq=v)
head(d, 10)

qdap
软件包允许您识别字符串中每个单词的词性:

library(qdap)
s1<-c("Hello World")  
pos(s1)
库(qdap)

谢谢你,律师。我认为它做了词性标注,但是,我无法将其导出到csv文件。给我以下的错误。as.data.frame.default(x[[i]],optional=TRUE,stringsAsFactors=stringsAsFactors)中出错:无法将类“pos”强制为data.frame请有人解释一下文本主题模式/检测。提前谢谢
library(qdap)
s1<-c("Hello World")  
pos(s1)