docstr: Assigns scores to colors for categories
  
  :param corpus: TermDocMatrix
  :param scorer: scorer
  :param color_palette: list of colors [[red, green, blue], ...]
docstr_tok: ["Assigns","scores","to","colors","for","categories",":","param","corpus",":","TermDocMatrix",":","param","scorer",":","scorer",":","param","color_palette",":","list","of","colors","[","[","red",",","green",",","blue","]",",","...","]"]
code: def __init__(
      self,
      corpus,
      scorer=RankDifference(),
      ranker=AbsoluteFrequencyRanker,
      use_non_text_features=False,
      color_palette=QUALITATIVE_COLORS,
  ):
      """
      Assigns scores to colors for categories
  
      :param corpus: TermDocMatrix
      :param scorer: scorer
      :param color_palette: list of colors [[red, green, blue], ...]
      """
      self.corpus = corpus
      self.scorer = scorer
      self.color_palette = color_palette
      my_ranker = ranker(corpus)
      if use_non_text_features:
          my_ranker.use_non_text_features()
      tdf = my_ranker.get_ranks()
      tdf_sum = tdf.sum(axis=1)
      term_scores = {}
      for cat in tdf.columns:
          term_scores[cat[:-5]] = pd.Series(
              self.scorer.get_scores(tdf[cat], tdf_sum - tdf[cat]),
              index=tdf.index,
          )
      self.term_cat = pd.DataFrame(term_scores).idxmax(axis=1)
      ranked_list_categories = (
          pd.Series(corpus.get_category_names_by_row())
          .value_counts()
          .index
      )
      self.category_colors = pd.Series(
          self.color_palette[: len(ranked_list_categories)],
          index=ranked_list_categories,
      )
  
file_path: scattertext/scattertext/CategoryColorAssigner.py
imports: import pandas
  from scattertext.termscoring.RankDifference import RankDifference
  from scattertext.Common import QUALITATIVE_COLORS
  from scattertext.termranking import AbsoluteFrequencyRanker
label_desc: Use image node_id 1 to create a new CategoryColorAssigner object from inherited base classes: object with example: obj = CategoryColorAssigner(corpus, scorer, ranker, use_non_text_features, color_palette)