code: def get_slot_queries(infold, slot_dict, mode, intent_names):
      """
      Convert each word in a query to corresponding slot number.
      Args:
          infold: fold of the data
          slot_dict: dict containing slot-names to positions
          mode: train, validation or test
          intent_names: list of intents
      """
      slot_queries = []
      outside_slot = len(slot_dict) - 1
  
      # keep the same order of files/queries as for intents
      for intent in intent_names:
          lines = open(
              f"{infold}/{mode}set/{intent}.csv", "r", encoding="utf-8"
          ).readlines()
          for line in lines[1:]:
              slot_query = ""
              query = line.split(";")[3]
              words = query.split(" ")
              current_slot = outside_slot
              for word in words:
                  if word[0] == "[":
                      current_slot = slot_dict[word[1:]]
                  elif word[0] == ":":
                      continue
                  else:
                      slot_query += str(current_slot) + " "
                      if word[-1] == "]":
                          current_slot = outside_slot
  
              slot_queries.append(slot_query.strip())
  
      return slot_queries
  
file_path: NeMo/scripts/dataset_processing/nlp/intent_and_slot/assistant_utils.py
imports: import os
  import re
  import shutil
  from nemo.collections.nlp.data.data_utils.data_preprocessing import DATABASE_EXISTS_TMP, if_exist, write_files
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: get_slot_queries(infold, slot_dict, mode, intent_names) and returns: slot_queries