0
我在r中使用tm包。一切工作正常,直到我包括stemCompletion。我收到以下錯誤:stemCompletion error using r tm package
Error in grep(sprintf("^%s", w), dictionary, value = TRUE) :
invalid regular expression
我的代碼如下:
path = '~/Interviews/Transcripts/'
file.names <- dir(path, pattern = '.txt')
corpus = lapply(seq_along(file.names), function(index) {
fileName = file.names[index]
filePath = paste(path, fileName, sep = '')
transcript = readChar(filePath, file.info(filePath)$size)
transcript <- gsub("[’‘^]", '', transcript)
corpusName = paste('transcript', index, sep = "_")
c <- Corpus(VectorSource(transcript))
DublinCore(c[[1]], 'Identifier') <- paste(index, fileName, sep ='_')
meta(c, type = 'corpus')
c <- tm_map(c, stripWhitespace)
c <- tm_map(c, content_transformer(tolower))
c <- tm_map(c, removeWords, c(stopwords("english"), 'yeah', 'yep'))
c <- tm_map(c, removePunctuation)
c <- tm_map(c, stemDocument)
c <- tm_map(c, stemCompletion, c)
c <- tm_map(c, PlainTextDocument)
c
})
這是不可重現的。祝你好運,找到能夠深入研究的人。 [這裏有一些技巧](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)關於如何做一個很好的例子。 –
你期望'stemCompletion'做什麼? – lukeA