I want to find the document similarity.
I am using the below R code
read 1000 txt articles from directory data/txt
corpus <-Corpus(DirSource("data/txt"), readerControl = list(blank.lines.skip=TRUE));
corpus <- tm_map(corpus, removeWords, stopwords("english")) corpus <- tm_map(corpus, stripWhitespace) corpus <- tm_map(corpus, stemDocument, language="english")
creating term matrix with TF-IDF weighting
terms <-DocumentTermMatrix(corpus,control = list(weighting = function(x) weightTfIdf(x, normalize = FALSE)))
or compute cosine distance among documents
dissimilarity(tdm, method = "cosine")
It seems dissimilarity function is not supported by the tm package any more. Is there a way to find the cosine angle between the documents. (Rows are documents, columns are texts. So i want to find the similarity between the rows using cosine angle).