code: def _get_term_freqs(dtm):
      if isinstance(dtm, np.ndarray):
          return dtm.sum(axis=0).ravel()
      if isinstance(dtm, np.matrix):
          return dtm.sum(axis=0).getA1()
      raise TypeError(str(type(dtm)))
  
file_path: pyLDAvis/notebooks/pyLDAvis/lda_model.py
imports: import funcy
  import pyLDAvis
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _get_term_freqs(dtm) and returns: dtm, dtm