code: def _maybe_split_wav_and_sentences(
      data_dir, trans_data, original_data, converted_data
  ):
      trans_dir = os.path.join(data_dir, trans_data)
      source_dir = os.path.join(data_dir, original_data)
      target_dir = os.path.join(data_dir, converted_data)
      if os.path.exists(target_dir):
          print("skipping maybe_split_wav")
          return
  
      os.makedirs(target_dir)
  
      files = []
  
      # Loop over transcription files and split corresponding wav
      for root, dirnames, filenames in os.walk(trans_dir):
          for filename in fnmatch.filter(filenames, "*.text"):
              if "trans" not in filename:
                  continue
              trans_file = os.path.join(root, filename)
              segments = _parse_transcriptions(trans_file)
  
              # Open wav corresponding to transcription file
              channel = ("2", "1")[
                  (os.path.splitext(os.path.basename(trans_file))[0])[6]
                  == "A"
              ]
              wav_filename = (
                  "sw0"
                  + (os.path.splitext(os.path.basename(trans_file))[0])[
                      2:6
                  ]
                  + "-"
                  + channel
                  + ".wav"
              )
              wav_file = os.path.join(source_dir, wav_filename)
  
              print(
                  "splitting {} according to {}".format(
                      wav_file, trans_file
                  )
              )
  
              if not os.path.exists(wav_file):
                  print("skipping. does not exist:" + wav_file)
                  continue
  
              origAudio = wave.open(wav_file, "r")
  
              # Loop over segments and split wav_file for each segment
              for segment in segments:
                  # Create wav segment filename
                  start_time = segment["start_time"]
                  stop_time = segment["stop_time"]
                  new_wav_filename = (
                      os.path.splitext(os.path.basename(trans_file))[0]
                      + "-"
                      + str(start_time)
                      + "-"
                      + str(stop_time)
                      + ".wav"
                  )
                  if _is_wav_too_short(new_wav_filename):
                      continue
                  new_wav_file = os.path.join(
                      target_dir, new_wav_filename
                  )
  
                  _split_wav(
                      origAudio, start_time, stop_time, new_wav_file
                  )
  
                  new_wav_filesize = os.path.getsize(new_wav_file)
                  transcript = segment["transcript"]
                  files.append(
                      (
                          os.path.abspath(new_wav_file),
                          new_wav_filesize,
                          transcript,
                      )
                  )
  
              # Close origAudio
              origAudio.close()
  
      return pandas.DataFrame(
          data=files,
          columns=["wav_filename", "wav_filesize", "transcript"],
      )
  
imports: import codecs
  import fnmatch
  import os
  import random
  import subprocess
  import sys
  import tarfile
  import unicodedata
  import wave
  import librosa
  import pandas
  import requests
  import soundfile
  from deepspeech_training.util.importers import validate_label_eng
label_desc: Use image node_id 7 for calling a global function with example usage: _maybe_split_wav_and_sentences(data_dir, trans_data, original_data, converted_data) and returns: pandas