code: def read_result(result_file, result_key):
      re_id = r"^id: "
      re_strings = {"Scores": r"^Scores: "}
      re_id = re.compile(re_id)
      re_patterns = {}
      for p in re_strings.keys():
          re_patterns[p] = re.compile(re_strings[p])
  
      results = OrderedDict()
      tmp_id, tmp_ret = None, {}
  
      with codecs.open(result_file, "r", encoding="utf-8") as f:
          for line in f:
              line = line.rstrip()
              lst = line.split()
  
              if re_id.match(line):
                  if tmp_id:
                      results[tmp_id] = {result_key: tmp_ret}
                      tmp_ret = {}
  
                  tmp_id = lst[1]
                  if tmp_id[0] == "(" and tmp_id[-1] == ")":
                      tmp_id = tmp_id[1:-1]
  
              for key, pat in re_patterns.items():
                  if pat.match(line):
                      tmp_ret[key] = " ".join(lst[1:])
  
      if tmp_ret != {}:
          results[tmp_id] = {result_key: tmp_ret}
  
      return results
  
file_path: espnet/egs2/fsc_unseen/asr1/pyscripts/utils/eval_perm_free_error.py
imports: import argparse
  import codecs
  import re
  import sys
  from collections import OrderedDict
  from pathlib import Path
  from typing import List
  import numpy
  from scipy.optimize import linear_sum_assignment
label_desc: Use image node_id 4 for calling a global function with example usage: read_result(result_file, result_key) and returns: results