code: def get_category_ranks(self, corpus: TermDocMatrix) -> np.array:
      if self.category_order is None:
          self.category_order = list(sorted(corpus.get_categories()))
      category_rank = {
          cat: i for i, cat in enumerate(self.category_order)
      }
      return np.array(
          [
              category_rank[category]
              for category in corpus.get_category_names_by_row()
          ]
      )
  
imports: import dataclasses
  from abc import ABC, abstractmethod
  from typing import List, Dict, Optional, Callable
  from sklearn.neighbors import KNeighborsRegressor
  import numpy
  import pandas
  from scattertext.dispersion.dispersion import Dispersion
  from scattertext.indexstore import IndexStoreFromList
  from scattertext.continuous.correlations import Correlations
  from scattertext.termranking import AbsoluteFrequencyRanker
  from scattertext.termranking.TermRanker import TermRanker
  from scattertext.TermDocMatrix import TermDocMatrix
  from scattertext.Scalers import get_scaler_name, scale_center_zero_abs, scale, dense_rank
  from scattertext.smoothing.mean_isotonic import MeanIsotonic
label_desc: Use image node_id 2 for calling the TrendPlotSettings obj's underlying member method code with example usage: obj.get_category_ranks(corpus) and returns: np