def _load_folder(folder_entry, corpus):
        """ Load the given subfolder into the corpus (e.g. bed, one, ...) """
        for wav_path in glob.glob(os.path.join(folder_entry.path, '*.wav')):
            wav_name = os.path.basename(wav_path)
            basename, __ = os.path.splitext(wav_name)

            command = folder_entry.name
            file_idx = '{}_{}'.format(basename, command)
            issuer_idx = str(basename).split('_', maxsplit=1)[0]

            corpus.new_file(wav_path, file_idx)

            if issuer_idx not in corpus.issuers.keys():
                corpus.import_issuers(issuers.Speaker(
                    issuer_idx
                ))

            utt = corpus.new_utterance(file_idx, file_idx, issuer_idx)

            labels = annotations.LabelList.create_single(command, idx=audiomate.corpus.LL_WORD_TRANSCRIPT)
            utt.set_label_list(labels)
def _load_folder ( folder_entry , corpus ) : for wav_path in glob . glob ( os . path . join ( folder_entry . path , '*.wav' ) ) : wav_name = os . path . basename ( wav_path ) basename , __ = os . path . splitext ( wav_name ) command = folder_entry . name file_idx = '{}_{}' . format ( basename , command ) issuer_idx = str ( basename ) . split ( '_' , maxsplit = 1 ) [ 0 ] corpus . new_file ( wav_path , file_idx ) if issuer_idx not in corpus . issuers . keys ( ) : corpus . import_issuers ( issuers . Speaker ( issuer_idx ) ) utt = corpus . new_utterance ( file_idx , file_idx , issuer_idx ) labels = annotations . LabelList . create_single ( command , idx = audiomate . corpus . LL_WORD_TRANSCRIPT ) utt . set_label_list ( labels )
Load the given subfolder into the corpus (e.g. bed, one, ...)