asrtoolkit/data_structures/corpus.py
def prepare_for_training(self, target=None):
    """
      Run validation and audio file preparation steps
    """

    # write corpus back in place if no target
    target = self.location if target is None else target

    # clean up
    basename = lambda file_name: file_name.split("/")[-1]

    executor = ThreadPoolExecutor()

    # process audio files concurrently for speed
    futures = [
      executor.submit(partial(_.audio_file.prepare_for_training, target + "/" + basename(_.audio_file.location)))
      for _ in self.exemplars
    ]

    # trigger conversion and gather results
    audio_files = [future.result() for future in tqdm(futures)]

    transcript_files = [
      _.transcript_file.write(target + "/" + basename(_.transcript_file.location)) for _ in self.exemplars
    ]

    new_corpus = corpus(
      {
        "location":
          target,
        "exemplars":
          [exemplar({
            "audio_file": af,
            "transcript_file": tf
          }) for af, tf in zip(audio_files, transcript_files)],
      }
    )
    new_corpus.validate()

      Run validation and audio file preparation steps
    
Run validation and audio file preparation steps
Run validation and audio file preparation steps
def prepare_for_training(self, target=None):
    target = self.location if target is None else target
    basename = lambda file_name: file_name.split("/")[-1]
    executor = ThreadPoolExecutor()
    futures = [
      executor.submit(partial(_.audio_file.prepare_for_training, target + "/" + basename(_.audio_file.location)))
      for _ in self.exemplars
    ]
    audio_files = [future.result() for future in tqdm(futures)]
    transcript_files = [
      _.transcript_file.write(target + "/" + basename(_.transcript_file.location)) for _ in self.exemplars
    ]
    new_corpus = corpus(
      {
        "location":
          target,
        "exemplars":
          [exemplar({
            "audio_file": af,
            "transcript_file": tf
          }) for af, tf in zip(audio_files, transcript_files)],
      }
    )
    new_corpus.validate()
def prepare_for_training ( self , target = None ) : target = self . location if target is None else target basename = lambda file_name : file_name . split ( "/" ) [ - 1 ] executor = ThreadPoolExecutor ( ) futures = [ executor . submit ( partial ( _ . audio_file . prepare_for_training , target + "/" + basename ( _ . audio_file . location ) ) ) for _ in self . exemplars ] audio_files = [ future . result ( ) for future in tqdm ( futures ) ] transcript_files = [ _ . transcript_file . write ( target + "/" + basename ( _ . transcript_file . location ) ) for _ in self . exemplars ] new_corpus = corpus ( { "location" : target , "exemplars" : [ exemplar ( { "audio_file" : af , "transcript_file" : tf } ) for af , tf in zip ( audio_files , transcript_files ) ] , } ) new_corpus . validate ( )
Run validation and audio file preparation steps
Run validation and audio file preparation steps
"""
      Run validation and audio file preparation steps
    """ # write corpus back in place if no target # clean up # process audio files concurrently for speed # trigger conversion and gather results
self
target