I have a document term matrix in cluto format:
#Document #Term #TotalItem
term-x weight-x term-y weight-y (for only nonzeros terms, a row per document)
Instead of a corpus, I want to create DocumentTermMatrix(tm package) from this file, is this possible?
Cluto File:
2 3 3
1 3 3 4
2 8
Row File:
car
plane
Column File:
x
y
z
Solution:
dtm = as.DocumentTermMatrix(read_stm_CLUTO(file), weightTf);
rows <- scan("rows.txt", what="", sep="\n");
columns <- scan("columns.txt", what="", sep="\n");
dtm$dimnames = list(rows,columns);