code: def ELANProcess(afile, spk_info, spk_details):
      try:
          elan_content = parse(afile).documentElement
      except Exception:
          print("encoding failed  %s" % afile)
          return None
      time_order = TimeOrderProcess(
          elan_content.getElementsByTagName("TIME_ORDER")[0]
      )
      tiers = elan_content.getElementsByTagName("TIER")
      channels = ({}, {})
      correction_channels = ({}, {})
      for tier in tiers:
          if tier.getAttribute("LINGUISTIC_TYPE_REF") not in [
              "UtteranceType",
              "Transcripción",
              "Traducción",
              "Transcripcion",
              "Traduccíón",
          ]:
              # only consider pure caption
              print(
                  "not handle tier {}".format(
                      tier.getAttribute("LINGUISTIC_TYPE_REF")
                  )
              )
              continue
          try:
              spk_name = " ".join(
                  tier.getAttribute("PARTICIPANT").strip().split()
              )
              code = spk_details[spk_name]
          except Exception:
              print(
                  "error speaker: %s"
                  % tier.getAttribute("PARTICIPANT").strip()
              )
              continue
          if code not in spk_info:
              print(spk_info)
              print("error code {}".format(code))
              continue
          if tier.getAttribute("LINGUISTIC_TYPE_REF") in [
              "UtteranceType",
              "Transcripción",
              "Transcripcion",
          ]:
              channel = channels[spk_info.index(code)]
              corr_flag = False
          elif tier.getAttribute("LINGUISTIC_TYPE_REF") in [
              "Traducción",
              "Traduccíón",
          ]:
              channel = correction_channels[spk_info.index(code)]
              corr_flag = True
          else:
              continue
          annotations = tier.getElementsByTagName("ANNOTATION")
          for anno in annotations:
              if corr_flag:
                  info = anno.getElementsByTagName("REF_ANNOTATION")[0]
                  ref = info.getAttribute("ANNOTATION_REF")
              else:
                  info = anno.getElementsByTagName(
                      "ALIGNABLE_ANNOTATION"
                  )[0]
                  seg_id = info.getAttribute("ANNOTATION_ID")
                  start = time_order[
                      info.getAttribute("TIME_SLOT_REF1")
                  ]
                  end = time_order[info.getAttribute("TIME_SLOT_REF2")]
                  if start == end:
                      continue
              text = ""
              childs = info.getElementsByTagName("ANNOTATION_VALUE")[
                  0
              ].childNodes
              for child in childs:
                  if child.firstChild is not None:
                      continue
                      text += child.firstChild.data
                  else:
                      text += child.data
              text = TextRefine(text)
              text = text.translate(trantab)
              if len(text) < 1:
                  continue
  
              if corr_flag:
                  channel[ref[1:]] = text
              else:
                  channel[seg_id[1:]] = [start, end, text]
      return channels, correction_channels
  
file_path: espnet/egs/puebla_nahuatl/st1/local/data_prep.py
imports: import os
  import re
  import string
  import sys
  from argparse import ArgumentParser
  from xml.dom.minidom import parse
label_desc: Use image node_id 8 for calling a global function with example usage: ELANProcess(afile, spk_info, spk_details) and returns: channels,  correction_channels, None