code: def loadXml(xmlFileName, opts):
      dom = minidom.parse(open(xmlFileName, "r"))
      trans = dom.getElementsByTagName("transcript")[0]
      segments = trans.getElementsByTagName("segments")[0]
      elements = []
      for segment in segments.getElementsByTagName("segment"):
          sid = (
              segment.attributes["id"]
              .value.split("_utt_")[0]
              .replace("_", "-")
          )
          startTime = float(segment.attributes["starttime"].value)
          endTime = float(segment.attributes["endtime"].value)
  
          tokens = [
              e.childNodes[0].data
              for e in segment.getElementsByTagName("element")
              if len(e.childNodes)
          ]
          # skip any word starts with '#'
          tokens = filter(lambda i: not i.startswith("#"), tokens)
          # convert to buckwalter if required
          if opts.buck:
              tokens = map(toBuckWalter, tokens)
  
          text = " ".join(tokens)
  
          elements.append(Element(text, startTime, endTime))
      return {"id": sid, "turn": elements}
  
file_path: espnet/egs/mgb2/asr1/local/xml2stm.py
imports: import sys
  from xml.dom import minidom
label_desc: Use image node_id 3 for calling a global function with example usage: loadXml(xmlFileName, opts) and returns: dict