class_docstr: Helper class for :class:`gensim.models.hdpmodel.HdpModel` to format the output of topics.
class_docstr_tok: ["Helper","class","for",":","class",":","`","gensim.models.hdpmodel.HdpModel","`","to","format","the","output","of","topics","."]
docstr: Initialise the :class:`gensim.models.hdpmodel.HdpTopicFormatter` and store topic data in sorted order.
  
  Parameters
  ----------
  dictionary : :class:`~gensim.corpora.dictionary.Dictionary`,optional
      Dictionary for the input corpus.
  topic_data : numpy.ndarray, optional
      The term topic matrix.
  topic_file : {file-like object, str, pathlib.Path}
      File, filename, or generator to read. If the filename extension is .gz or .bz2, the file is first
      decompressed. Note that generators should return byte strings for Python 3k.
  style : bool, optional
      If True - get the topics as a list of strings, otherwise - get the topics as lists of (word, weight) pairs.
  
  Raises
  ------
  ValueError
      Either dictionary is None or both `topic_data` and `topic_file` is None.
code: def __init__(
      self,
      dictionary=None,
      topic_data=None,
      topic_file=None,
      style=None,
  ):
      """Initialise the :class:`gensim.models.hdpmodel.HdpTopicFormatter` and store topic data in sorted order.
  
      Parameters
      ----------
      dictionary : :class:`~gensim.corpora.dictionary.Dictionary`,optional
          Dictionary for the input corpus.
      topic_data : numpy.ndarray, optional
          The term topic matrix.
      topic_file : {file-like object, str, pathlib.Path}
          File, filename, or generator to read. If the filename extension is .gz or .bz2, the file is first
          decompressed. Note that generators should return byte strings for Python 3k.
      style : bool, optional
          If True - get the topics as a list of strings, otherwise - get the topics as lists of (word, weight) pairs.
  
      Raises
      ------
      ValueError
          Either dictionary is None or both `topic_data` and `topic_file` is None.
  
      """
      if dictionary is None:
          raise ValueError("no dictionary!")
  
      if topic_data is not None:
          topics = topic_data
      elif topic_file is not None:
          topics = np.loadtxt("%s" % topic_file)
      else:
          raise ValueError("no topic data!")
  
      # sort topics
      topics_sums = np.sum(topics, axis=1)
      idx = matutils.argsort(topics_sums, reverse=True)
      self.data = topics[idx]
  
      self.dictionary = dictionary
  
      if style is None:
          style = self.STYLE_GENSIM
  
      self.style = style
  
imports: import logging
  import time
  import warnings
  import numpy
  from scipy.special import gammaln, psi
  from gensim import interfaces, utils, matutils
  from gensim.matutils import dirichlet_expectation, mean_absolute_difference
  from gensim.models import basemodel, ldamodel
  from gensim.utils import deprecated
label_desc: Use image node_id 1 to create a new HdpTopicFormatter object  with example: obj = HdpTopicFormatter(dictionary, topic_data, topic_file, style)