code: def release2prediction(
      example: Dict[str, Any], load_gold: bool = False
  ):
      """
      Convert the SLURP release format into prediction format.
  
      :param example: the example in release format\
              (as they come with the dataset release)
      :param load_gold: When evaluating gold hypotheses upper bound
      :return: a list of examples in prediction format: List[Dict[str, Union[str, List]]]
      """
      result = {}
      res = {
          "text": " ".join([t["surface"] for t in example["tokens"]]),
          "scenario": example["scenario"],
          "action": example["action"],
          "entities": [
              {
                  "type": entity["type"],
                  "filler": " ".join(
                      [
                          example["tokens"][i]["surface"].lower()
                          for i in entity["span"]
                      ]
                  ),
              }
              for entity in example["entities"]
          ],
      }
      if load_gold:
          result[str(example["slurp_id"])] = res
      else:
          for file in example["recordings"]:
              result[file["file"]] = res
      return result
  
file_path: espnet/egs2/slurp_entity/asr1/local/evaluation/util.py
imports: import json
  import logging
  import os
  from typing import Any, Dict, Tuple
  import tabulate
  from progress.bar import Bar
label_desc: Use image node_id 3 for calling a global function with example usage: release2prediction(example, load_gold) and returns: result