code: def get_category_map(
      personalities: Dict[str, List[str]]
  ) -> Dict[str, str]:
      """
      Map personalities to polarity categories: "positive/neutral" and "negative".
  
      Given a dictionary mapping Image-Chat categories (positive/neutral/negative) to
      personalities, return a dictionary mapping each personality to its category.
      Categories are merged into only two buckets: "positive/neutral", for personalities
      that are more likely to be safe to use, and "negative". Add in rare personalities.
      """
  
      category_map = {
          personality: _get_final_category(category)
          for category, personalities in personalities.items()
          for personality in personalities
      }
      category_map["Crude"] = _get_final_category("negative")
      category_map["Earnest"] = _get_final_category("positive")
      # These personalities occasionally appear but are not in personalities
      return category_map
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  import json
  import os
  import random
  from typing import Tuple, Dict, List
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.core.image_featurizers import ImageLoader
  from parlai.utils.typing import TShared
  from parlai.utils.io import PathManager
  from .build import build
label_desc: Use image node_id 2 for calling a global function with example usage: get_category_map(personalities) and returns: category_map