class_docstr: Creates a topic model from a set of key terms based on sentence level co-occurrence.
class_docstr_tok: ["Creates","a","topic","model","from","a","set","of","key","terms","based","on","sentence","level","co-occurrence","."]
docstr: Parameters
  ----------
  pipe : Pipeline
          For example, `Pipeline([
                  ('tfidf', TfidfTransformer(sublinear_tf=True)),
                  ('nmf', (NMF(n_components=30, l1_ratio=.5, random_state=0)))])`
          The last transformer must populate a `components_` attribute when finished.
  num_terms_per_topic : int
  
  Returns
  -------
  dict: {term: [term1, ...], ...}
docstr_tok: ["Parameters","--","--","--","--","--","pipe",":","Pipeline","For","example",",","`","Pipeline","(","[","(","'tfidf","'",",","TfidfTransformer","(","sublinear_tf=True",")",")",",","(","'nmf","'",",","(","NMF","(","n_components=30",",","l1_ratio=.5",",","random_state=0",")",")",")","]",")","`","The","last","transformer","must","populate","a","`","components_","`","attribute","when","finished",".","num_terms_per_topic",":","int","Returns","--","--","--","-","dict",":","{","term",":","[","term1",",","...","]",",","...","}"]
code: def get_topics_from_model(self, pipe=None, num_terms_per_topic=10):
      """
  
      Parameters
      ----------
      pipe : Pipeline
              For example, `Pipeline([
                      ('tfidf', TfidfTransformer(sublinear_tf=True)),
                      ('nmf', (NMF(n_components=30, l1_ratio=.5, random_state=0)))])`
              The last transformer must populate a `components_` attribute when finished.
      num_terms_per_topic : int
  
      Returns
      -------
      dict: {term: [term1, ...], ...}
      """
      pipe = self._fit_model(pipe)
      topic_model = {}
      for topic_idx, topic in enumerate(
          pipe._final_estimator.components_
      ):
          term_list = [
              self.termidxstore.getval(i)
              for i in topic.argsort()[: -num_terms_per_topic - 1 : -1]
              if topic[i] > 0
          ]
          if len(term_list) > 0:
              topic_model[
                  "%s. %s" % (topic_idx, term_list[0])
              ] = term_list
          else:
              Warning(
                  "Topic %s has no terms with scores > 0. Omitting."
                  % (topic_idx)
              )
      return topic_model
  
file_path: scattertext/scattertext/topicmodel/SentencesForTopicModeling.py
imports: import numpy
  import pandas
  from sklearn.decomposition import NMF
  from sklearn.feature_extraction.text import TfidfTransformer
  from sklearn.pipeline import Pipeline
  from scattertext.CSRMatrixTools import CSRMatrixFactory
  from scattertext.ParsedCorpus import ParsedCorpus
  from scattertext.termscoring.RankDifference import RankDifference
label_desc: Use image node_id 4 for calling the SentencesForTopicModeling obj's underlying member method code with example usage: obj.get_topics_from_model(pipe, num_terms_per_topic) and returns: topic_model