class_docstr: Data Processor for Assistant dialogues.
class_docstr_tok: ["Data","Processor","for","Assistant","dialogues","."]
docstr: Extract continuous spans of slot_ids
  
  To accomodate slots with distinct labels for B-label1 and I-label1, 
  slot_id = self.bio_slot_ids_to_unified_slot_ids[slot_id] is called to map them both to label1
  
  Args:
      Slot: list of int representing slot of each word token
      For instance, 54 54 54 54 54 54 54 54 18 54 44 44 54 46 46 54 12 
      Corresponds to "please set an alarm clock for my next meeting with the team at three pm next friday"
      Except for the empty_slot_id (54 in this case), we hope to extract the continuous spans of tokens,
      each containing a start position and an exclusive end position
      E.g {18: [9, 10], 44: [11, 13], 46: [14, 16], 12: [17, 18]}
docstr_tok: ["Extract","continuous","spans","of","slot_ids","To","accomodate","slots","with","distinct","labels","for","B-label1","and","I-label1",",","slot_id","=","self.bio_slot_ids_to_unified_slot_ids","[","slot_id","]","is","called","to","map","them","both","to","label1","Args",":","Slot",":","list","of","int","representing","slot","of","each","word","token","For","instance",",","54","54","54","54","54","54","54","54","18","54","44","44","54","46","46","54","12","Corresponds","to","``","please","set","an","alarm","clock","for","my","next","meeting","with","the","team","at","three","pm","next","friday","''","Except","for","the","empty_slot_id","(","54","in","this","case",")",",","we","hope","to","extract","the","continuous","spans","of","tokens",",","each","containing","a","start","position","and","an","exclusive","end","position","E.g","{","18",":","[","9",",","10","]",",","44",":","[","11",",","13","]",",","46",":","[","14",",","16","]",",","12",":","[","17",",","18","]","}"]
code: def get_continuous_slots(
      slot_ids, empty_slot_id, bio_slot_ids_to_unified_slot_ids
  ):
      """
      Extract continuous spans of slot_ids
  
      To accomodate slots with distinct labels for B-label1 and I-label1,
      slot_id = self.bio_slot_ids_to_unified_slot_ids[slot_id] is called to map them both to label1
  
      Args:
          Slot: list of int representing slot of each word token
          For instance, 54 54 54 54 54 54 54 54 18 54 44 44 54 46 46 54 12
          Corresponds to "please set an alarm clock for my next meeting with the team at three pm next friday"
          Except for the empty_slot_id (54 in this case), we hope to extract the continuous spans of tokens,
          each containing a start position and an exclusive end position
          E.g {18: [9, 10], 44: [11, 13], 46: [14, 16], 12: [17, 18]}
      """
      slot_id_stack = []
      position_stack = []
      for i in range(len(slot_ids)):
          slot_id = slot_ids[i]
  
          slot_id = bio_slot_ids_to_unified_slot_ids[slot_id]
  
          if not slot_id_stack or slot_id != slot_id_stack[-1]:
              slot_id_stack.append(slot_id)
              position_stack.append([])
          position_stack[-1].append(i)
  
      slot_id_to_start_and_exclusive_end = {
          slot_id_stack[i]: [
              position_stack[i][0],
              position_stack[i][-1] + 1,
          ]
          for i in range(len(position_stack))
          if slot_id_stack[i] != empty_slot_id
      }
  
      return slot_id_to_start_and_exclusive_end
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/data_processor/assistant_data_processor.py
imports: import os
  from nemo.collections.nlp.data.dialogue.data_processor.data_processor import DialogueDataProcessor
  from nemo.collections.nlp.data.dialogue.input_example.input_example import DialogueInputExample
label_desc: Use image node_id 4 for calling the DialogueAssistantDataProcessor obj's underlying member method code with example usage: obj.get_continuous_slots(slot_ids, empty_slot_id, bio_slot_ids_to_unified_slot_ids) and returns: slot_id_to_start_and_exclusive_end