code: def _extract_data(lda_model, dtm, vectorizer):
      vocab = _get_vocab(vectorizer)
      doc_lengths = _get_doc_lengths(dtm)
      term_freqs = _get_term_freqs(dtm)
      topic_term_dists = _get_topic_term_dists(lda_model)
      err_msg = (
          "Topic-term distributions and document-term matrix"
          "have different number of columns, {} != {}."
      )
  
      assert term_freqs.shape[0] == len(
          vocab
      ), "Term frequencies and vocabulary are of different sizes, {} != {}.".format(
          term_freqs.shape[0], len(vocab)
      )
  
      assert topic_term_dists.shape[1] == dtm.shape[1], err_msg.format(
          topic_term_dists.shape[1], len(vocab)
      )
  
      # column dimensions of document-term matrix and topic-term distributions
      # must match first before transforming to document-topic distributions
      doc_topic_dists = _get_doc_topic_dists(lda_model, dtm)
      return {
          "vocab": vocab,
          "doc_lengths": doc_lengths.tolist(),
          "term_frequency": term_freqs.tolist(),
          "doc_topic_dists": doc_topic_dists.tolist(),
          "topic_term_dists": topic_term_dists.tolist(),
      }
  
file_path: pyLDAvis/pyLDAvis/lda_model.py
imports: import funcy
  import pyLDAvis
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: _extract_data(lda_model, dtm, vectorizer) and returns: dict