code: def embed_categories(
      self, corpus: TermDocMatrix, non_text: bool = False
  ) -> np.array:
      tdf = corpus.get_freq_df(use_metadata=non_text, label_append="")
      term_freqs = tdf.sum(axis=1)
      score_df = pd.DataFrame(
          {
              category: pd.Series(
                  self.__get_scores_for_category(
                      str(category), tdf, term_freqs, non_text, corpus
                  ),
                  index=corpus.get_terms(use_metadata=non_text),
              )
              .sort_values(ascending=False)
              .head(self.rank_threshold)
              for category in corpus.get_categories()
          }
      )
      return score_df.fillna(0).T.values
  
file_path: scattertext/scattertext/categorygrouping/rank_embedder.py
imports: from abc import ABCMeta
  from typing import Optional, Callable, Dict
  import numpy
  import pandas
  from scattertext.TermDocMatrix import TermDocMatrix
  from scattertext.termscoring.RankDifference import RankDifference
  from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer
  from scattertext.categorygrouping.characteristic_embedder_base import CategoryEmbedderABC
  from scattertext.util import inherits_from
label_desc: Use image node_id 2 for calling the RankEmbedder obj's underlying member method code with example usage: obj.embed_categories(corpus, non_text) and returns: score_df