docstr:         Split target into label and slots when doing joint label (i.e. intent) classificaiton and slot filling
  
          For instance, split "reserve_restaurant
  slots: time_of_day(7pm), number_of_people(3)" into 
          label = "reserve_restaurant" and slots = ["time_of_day(7pm)", "number_of_people(3)"]
          Args:
              fields: list of strings 
          
docstr_tok: ["Split","target","into","label","and","slots","when","doing","joint","label","(","i.e",".","intent",")","classificaiton","and","slot","filling","For","instance",",","split","``","reserve_restaurant","slots",":","time_of_day","(","7pm",")",",","number_of_people","(","3",")","''","into","label","=","``","reserve_restaurant","''","and","slots","=","[","``","time_of_day","(","7pm",")","''",",","``","number_of_people","(","3",")","''","]","Args",":","fields",":","list","of","strings"]
code: def split_label_and_slots(fields, with_slots=False):
      """
      Split target into label and slots when doing joint label (i.e. intent) classificaiton and slot filling
  
      For instance, split "reserve_restaurant\nslots: time_of_day(7pm), number_of_people(3)" into
      label = "reserve_restaurant" and slots = ["time_of_day(7pm)", "number_of_people(3)"]
      Args:
          fields: list of strings
      """
      labels = []
      slots_list = []
      for field in fields:
          if with_slots:
              combo = [i.strip() for i in field.split("slots:", 1)]
              label = "none"
              if len(combo) == 2:
                  label, slots = combo
              elif len(combo) == 1:
                  slots = combo[0]
                  label = "none"
              if isinstance(slots, str):
                  # temporary patch for purnendu model output
                  if "possible intents:" in slots:
                      slots = slots.split("possible intents:")[0]
                  slots = slots.split(", ")
              else:
                  slots = ["None"]
          else:
              label = field
              slots = []
          slots_list.append(slots)
          labels.append(label)
  
      return labels, slots_list
  
file_path: NeMo/nemo/collections/nlp/metrics/dialogue_metrics.py
imports: import json
  from collections import Counter
  import numpy
  from sacrebleu import corpus_bleu
label_desc: Use image node_id 2 for calling the DialogueClassificationMetrics obj's underlying member method code with example usage: obj.split_label_and_slots(fields, with_slots) and returns: labels,  slots_list