def split(self, transcript, target_dir):
    """
      Split audio file and transcript into many pieces based on valid segments of transcript
    """

    os.makedirs(target_dir, exist_ok=True)
    for iseg, seg in enumerate(transcript.segments):
      cut_utterance(self.location, generate_segmented_file_name(target_dir, self.location, iseg), seg.start, seg.stop)
    transcript.split(target_dir)

    return
示例#2
0
 def split(self, target_dir):
     """
     Split transcript into many pieces based on valid segments of transcript
     """
     os.makedirs(target_dir, exist_ok=True)
     for iseg, seg in enumerate(self.segments):
         new_seg = time_aligned_text()
         new_seg.file_extension = self.file_extension
         new_seg.location = generate_segmented_file_name(
             target_dir, self.location, iseg)
         new_seg.segments = [seg]
         new_seg.write(new_seg.location)