TaeYeoun  Roh
TaeYeoun Roh

Reputation: 1

How could I make document term matrix with my own term list?

I have 690 sentences an own term list with 500 words,

So I want to make Document term matrix, like:

enter image description here

I've tried to use DocumentTermMatrix in tm packages, but I cannot find the way of making matrix own words list. What should I do? Or what packages or function that you recommend?

Upvotes: 0

Views: 407

Answers (1)

knb
knb

Reputation: 9303

Define your own vector of stopwords, then remove all Terms that are in that vector.

Basic Idea:

mystopwords <- setdiff(unique(Terms(mydtm)), mywordvect)

mycorpus <- tm_map(mycorpus, removeWords, mystopwords)

(convert mycorpus to DTM gain...)

You'll have to find out on the details yourself.

Upvotes: 0

Related Questions