2017-10-01 1 views
-1

40種類のテキストのコーパスの文書用語行列(dtm)を作成しようとしています。私は20文字以上の単語を含まないようにしています。これどうやってするの?文書用語Matric(dtm) - R

答えて

1

あなたがコントロール引数としてwordLenghtsを渡してみてください:

library(tm) 
DocumentTermMatrix(corpus,control=list(wordLengths=c(1,20))) 

ドキュメントから:

wordLenghts - An integer vector of length 2. Words shorter than the minimum word length wordLengths[1] or longer than the maximum word length wordLengths[2] are discarded. Defaults to c(3, Inf), i.e., a minimum word length of 3 characters. 
関連する問題