Skip to content

Commit

Permalink
hts: fix for wrong HTS labels
Browse files Browse the repository at this point in the history
  • Loading branch information
r9y9 committed Mar 8, 2023
1 parent 0f21d1a commit 9480fde
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nnsvs/io/hts.py
Expand Up @@ -396,7 +396,13 @@ def overwrite_phoneme_flags_(labels, flag):

contexts = labels.contexts
for i in range(len(contexts)):
assert len(_flag_re.findall(contexts[i])) == 1, (i, contexts[i])
n = len(_flag_re.findall(contexts[i]))
if n == 0:
print(i, contexts[i])
print("Warn: it is likely to have a wrong input format. Ignoring.")
elif n != 1:
print(i, contexts[i])
raise RuntimeError("More than two flags are found")
contexts[i] = _flag_re.sub(f"^{flag}_", contexts[i])
labels.contexts = contexts

Expand Down

0 comments on commit 9480fde

Please sign in to comment.