From f123a235f4621e09e5e4f80ec0fd8d1d09d976ff Mon Sep 17 00:00:00 2001 From: Mathieu Bernard Date: Wed, 29 Aug 2018 13:41:28 +0200 Subject: [PATCH] improved comment --- phonemizer/festival.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phonemizer/festival.py b/phonemizer/festival.py index 407ecb5..eb2aae3 100644 --- a/phonemizer/festival.py +++ b/phonemizer/festival.py @@ -89,8 +89,9 @@ def _double_quoted(line): def _cleaned(line): """Remove 'forbidden' characters from the line""" - # special case (very unlikely) where a line is only made of ' - if len(set(line) - set("'")) == 0: + # special case (very unlikely but causes a crash in festival) + # where a line is only made of ' + if set(line) == set("'"): line = '' # remove forbidden characters (reserved for scheme, ie festival @@ -108,6 +109,7 @@ def _preprocess(text): """ cleaned_text = ( _cleaned(line) for line in text.split('\n') if line != '') + return '\n'.join( _double_quoted(line) for line in cleaned_text if line != '')