read.py: allow user-specified splits

This commit is contained in:
James Betker 2022-05-12 11:24:55 -06:00
parent 945bd88f21
commit 0005d02940
2 changed files with 10 additions and 4 deletions

0
tortoise/data/layman.txt Normal file
View File

View File

@ -48,14 +48,20 @@ if __name__ == '__main__':
if regenerate is not None:
regenerate = [int(e) for e in regenerate.split(',')]
# Process text
with open(args.textfile, 'r', encoding='utf-8') as f:
text = ' '.join([l for l in f.readlines()])
if '|' in text:
print("Found the '|' character in your text, which I will use as a cue for where to split it up. If this was not"
"your intent, please remove all '|' characters from the input.")
texts = text.split('|')
else:
texts = split_and_recombine_text(text)
for selected_voice in selected_voices:
voice_outpath = os.path.join(outpath, selected_voice)
os.makedirs(voice_outpath, exist_ok=True)
with open(args.textfile, 'r', encoding='utf-8') as f:
text = ''.join([l for l in f.readlines()])
texts = split_and_recombine_text(text)
if '&' in selected_voice:
voice_sel = selected_voice.split('&')
else: