def load_voices_from_transcript(self):
transcripts = os.listdir('texts/transcripts')
for i in range(len(transcripts)):
print("%s %s" % (i + 1, transcripts[i]))
choice = input('Enter the number of the transcript you want to load:\n')
transcript_name = transcripts[int(choice) - 1]
number = int(input('Enter the number of voices to load:\n'))
for charname, size in self.biggest_characters(transcript_name, number):
print(charname)
path = 'texts/transcripts/%s/%s' % (transcript_name, charname)
source_text = open(path).read()
corpus_name = charname
weighted_corpora = {}
weighted_corpora[charname] = [Corpus(source_text, corpus_name), 1]
self.voices[charname] = Voice(weighted_corpora, charname)
# retrieves a list of the top 20 largest character text files in a transcript folder
评论列表
文章目录