code: def __get_X(
      self, corpus, non_text, term_doc_mat, term_ranker, use_categories
  ):
      if term_doc_mat is not None:
          return term_doc_mat
      if corpus is not None:
          self.corpus = corpus
          if use_categories is True:
              if term_ranker is None:
                  term_ranker = AbsoluteFrequencyRanker
  
              term_ranker = term_ranker(
                  term_doc_matrix=corpus
              ).set_non_text(non_text=non_text)
              return csr_matrix(term_ranker.get_ranks("").values.T)
              # return term_ranker.get_ranks('').values
          else:
              return corpus.get_term_doc_mat(non_text=non_text)
              # if non_text:
              # if use_categories is False:
              # X = corpus.get_metadata_doc_mat()
              # else:
              #    X = csr_matrix(corpus.get_metadata_freq_df().values.T)
              # else:
              # if use_categories is False:
  
              # else:
              # X = csr_matrix(corpus.get_term_freq_df().values.T)
      raise Exception()
  
imports: from typing import Optional, Callable, List
  import numpy
  import pandas
  from scattertext.termranking import AbsoluteFrequencyRanker
  from scipy.sparse import csc_matrix, csr_matrix
  from sklearn.preprocessing import StandardScaler
  from scattertext.smoothing.lowess import Lowess
  from scattertext.termranking.TermRanker import TermRanker
  from scattertext.TermDocMatrix import TermDocMatrix
label_desc: Use image node_id 2 for calling the Dispersion obj's underlying member method code with example usage: obj.__get_X(corpus, non_text, term_doc_mat, term_ranker, use_categories) and returns: term_doc_mat, csr_matrix, corpus