我知道我可以使用字典功能使用TM包來算的特定詞的出現在語料:如何在TermDocumentMatrix中使用正則表達式進行文本挖掘?
require(tm)
data(crude)
dic <- Dictionary("crude")
tdm <- TermDocumentMatrix(crude, control = list(dictionary = dic, removePunctuation = TRUE))
inspect(tdm)
我想知道是否有一個設施,而不是提供一個正則表達式字典而不是一個固定的詞?
有時制止可能不是我想要的東西(例如我可能要拿起拼寫錯誤),所以我想這樣做:
dic <- Dictionary(c("crude",
"\\bcrud[[:alnum:]]+"),
"\\bcrud[de]")
,從而繼續使用TM的設施包?