code: def generate_vocabs(datasets):
      event_type_set = set()
      role_type_set = set()
      for dataset in datasets:
          event_type_set.update(dataset.event_type_set)
          role_type_set.update(dataset.role_type_set)
  
      event_type_itos = sorted(event_type_set)
      role_type_itos = sorted(role_type_set)
  
      event_type_stoi = {k: i for i, k in enumerate(event_type_itos)}
      role_type_stoi = {k: i for i, k in enumerate(role_type_itos)}
  
      return {
          "event_type_itos": event_type_itos,
          "event_type_stoi": event_type_stoi,
          "role_type_itos": role_type_itos,
          "role_type_stoi": role_type_stoi,
      }
  
file_path: DeepKE/src/deepke/event_extraction/standard/degree/utils.py
imports: from tensorboardX import SummaryWriter
label_desc: Use image node_id 1 for calling a global function with example usage: generate_vocabs(datasets) and returns: dict