From 3ef7e36478a326708d8c5ce6b45c3fe2aec60a24 Mon Sep 17 00:00:00 2001 From: begeekmyfriend Date: Thu, 13 Jun 2019 14:57:23 +0800 Subject: [PATCH] Read sentences from file Signed-off-by: begeekmyfriend --- synthesize.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/synthesize.py b/synthesize.py index 6db0f293..8cdc5893 100644 --- a/synthesize.py +++ b/synthesize.py @@ -23,8 +23,14 @@ def prepare_run(args): def get_sentences(args): if args.text_list != '': - with open(args.text_list, 'rb') as f: - sentences = list(map(lambda l: l.decode("utf-8")[:-1], f.readlines())) + with open(args.text_list) as f: + #sentences = list(map(lambda l: l.decode("utf-8")[:-1], f.readlines())) + i = 0 + sentences = [] + for line in f.readlines(): + i += 1 + if i % 2 == 0: + sentences.append(line.strip()) else: sentences = hparams.sentences return sentences