get_documents_topics.Rd
Get document-topics matrix.
get_docs_topics(corpus) # S3 method for gensim.interfaces.CorpusABC get_docs_topics(corpus)
corpus | Corpus. |
---|
#> → Preprocessing 9 documents #> ← 9 documents after perprocessingdictionary <- corpora_dictionary(docs) corpora <- doc2bow(dictionary, docs) corpus_mm <- serialize_mmcorpus(corpora) tfidf <- model_tfidf(corpus_mm) corpus_transformed <- wrap(tfidf, corpora) # fit model lsi <- model_lsi(corpus_transformed, id2word = dictionary, num_topics = 2L) wrapped_corpus <- wrap(lsi, corpus_transformed) get_docs_topics(wrapped_corpus)#> # A tibble: 9 x 4 #> dimension_1_x dimension_1_y dimension_2_x dimension_2_y #> <dbl> <dbl> <dbl> <dbl> #> 1 0 0.0660 1 -0.520 #> 2 0 0.197 1 -0.761 #> 3 0 0.0899 1 -0.724 #> 4 0 0.0759 1 -0.632 #> 5 0 0.102 1 -0.574 #> 6 0 0.703 1 0.161 #> 7 0 0.877 1 0.168 #> 8 0 0.910 1 0.141 #> 9 0 0.617 1 -0.0539