我需要得到不带偏折的大学和三联图
trigramTokenizer <- function(x) NGramTokenizer(x, Weka_control(min = 1, max = 3))如何编辑此代码以获得答案
发布于 2016-05-24 07:24:30
一种方法是使用来自dfm包的quanteda函数,如下所示,
library(quanteda)
dfm('I only want uni and trigrams', ngrams = c(1,3), verbose = FALSE)
#Document-feature matrix of: 1 document, 10 features.
#1 x 10 sparse Matrix of class "dfmSparse"
# features
#docs i only want uni and trigrams i_only_want only_want_uni want_uni_and uni_and_trigrams
# text1 1 1 1 1 1 1 1 1 1 1https://stackoverflow.com/questions/37405622
复制相似问题