我正在尝试从 Quanteda dfm 中提取已识别的字典单词,但一直无法找到解决方案。
有人对此有解决方案吗?
样本输入:
dict <- dictionary(list(season = c("spring", "summer", "fall", "winter")))
dfm <- dfm("summer is great", dictionary = dict)
输出:
> dfm
Document-feature matrix of: 1 document, 1 feature.
1 x 1 sparse Matrix of class "dfmSparse"
features
docs season
text1 1
我现在知道句子中已经确定了一个季节性字典词,但我也想知道它是哪个词。
这最好以表格格式提取:
docs dict dictWord
text1 season summer