Skip to content

Commit

Permalink
improved comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmaat committed Aug 29, 2018
1 parent a2af480 commit f123a23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phonemizer/festival.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 != '')

Expand Down

0 comments on commit f123a23

Please sign in to comment.