class_docstr: Create topic model widget.
docstr: Creates Pandas DataFrame to display most relevant terms for each topic.
  
  Args:
      num_topic_words: The number of words to be displayed for each topic.
          Default is 10
      topic_names: A list of pre-defined names set for each of the topics.
          Default is None
  
  Returns:
      display_topics_df: Pandas DataFrame displaying topics as columns and their
          relevant terms as rows. LDA/LSI models will display an extra column to
          the right of each topic column, showing each term's corresponding
          coefficient value
code: def display_topic_keywords(
      self,
      num_topic_words: int = 10,
      topic_names: Optional[List[str]] = None,
  ):
      """Creates Pandas DataFrame to display most relevant terms for each topic.
  
      Args:
          num_topic_words: The number of words to be displayed for each topic.
              Default is 10
          topic_names: A list of pre-defined names set for each of the topics.
              Default is None
  
      Returns:
          display_topics_df: Pandas DataFrame displaying topics as columns and their
              relevant terms as rows. LDA/LSI models will display an extra column to
              the right of each topic column, showing each term's corresponding
              coefficient value
      """
      display_topics_dict = {}
      if self._model_type == "NMF" or self._model_type == "SVD":
          for topic_num, topic in enumerate(self._model.components_):
              if not topic_names or not topic_names[topic_num]:
                  key = "Topic {}".format(topic_num + 1)
              else:
                  key = "Topic: {}".format(topic_names[topic_num])
              display_topics_dict[key] = [
                  self._matrix.columns[i]
                  for i in topic.argsort()[: -num_topic_words - 1 : -1]
              ]
      elif (
          self._model_type == "LSI"
          or self._model_type == "LSA"
          or self._model_type == "LDA"
      ):
          for topic_num, topic in self._model.print_topics(
              num_words=num_topic_words
          ):
              topic_words = [
                  topic.split()[num].split("*")[1].replace('"', "")
                  for num in range(0, len(topic.split()), 2)
              ]
              topic_coefficients = [
                  topic.split()[num].split("*")[0]
                  for num in range(0, len(topic.split()), 2)
              ]
              if not topic_names or not topic_names[topic_num]:
                  key = "Topic {}".format(topic_num + 1)
                  coefficient_key = "Topic {} Coefficient Value".format(
                      topic_num + 1
                  )
              else:
                  key = "Topic: {}".format(topic_names[topic_num])
                  coefficient_key = (
                      "Topic: {} - Coefficient Value".format(
                          topic_names[topic_num]
                      )
                  )
              (
                  display_topics_dict[key],
                  display_topics_dict[coefficient_key],
              ) = (
                  topic_words,
                  topic_coefficients,
              )
  
      term_numbers = [
          "Term {}".format(num + 1) for num in range(num_topic_words)
      ]
      display_topics_df = pd.DataFrame(
          display_topics_dict, index=term_numbers
      )
      return display_topics_df
  
imports: import warnings
  from typing import List, Optional, Dict, Tuple, TYPE_CHECKING
  import pandas
  import numpy
  from sklearn.decomposition import TruncatedSVD, NMF
  import matplotlib.pyplot
  import seaborn
  from data_describe.config._config import get_option
  from data_describe.text.text_preprocessing import create_doc_term_matrix, create_tfidf_matrix, filter_dictionary
  from data_describe.backends import _get_viz_backend
  from data_describe.compat import _compat, _requires, _in_notebook
  from data_describe._widget import BaseWidget
label_desc: Use image node_id 20 for calling the TopicModelWidget obj's underlying member method code with example usage: obj.display_topic_keywords(num_topic_words, topic_names) and returns: display_topics_df