rm space for pure Chinese

pull/1040/head
TianYuan 3 years ago committed by root
parent dad1cbbcd6
commit a861e56e91

@ -36,7 +36,7 @@ def evaluate(args, fastspeech2_config, pwg_config):
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
with open(args.phones_dict, "r") as f:

@ -84,7 +84,7 @@ def main():
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
for utt_id, sentence in sentences:

@ -39,7 +39,7 @@ def evaluate(args, fastspeech2_config, pwg_config):
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
with open(args.phones_dict, "r") as f:

@ -42,7 +42,7 @@ def evaluate(args, fastspeech2_config, pwg_config):
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
with open(args.phones_dict, "r") as f:

@ -42,7 +42,7 @@ def evaluate(args, fastspeech2_config, melgan_config):
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
with open(args.phones_dict, "r") as f:

@ -89,7 +89,7 @@ def main():
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
for utt_id, sentence in sentences:

@ -42,7 +42,7 @@ def evaluate(args, speedyspeech_config, pwg_config):
for line in f:
items = line.strip().split()
utt_id = items[0]
sentence = ",".join(items[1:])
sentence = "".join(items[1:])
sentences.append((utt_id, sentence))
with open(args.phones_dict, "r") as f:

@ -129,6 +129,8 @@ class Frontend():
# we discriminate i, ii and iii
if c and c not in self.punc:
phones.append(c)
if c and c in self.punc:
phones.append('sp')
if v and v not in self.punc:
phones.append(v)
# add sp between sentence (replace the last punc with sp)

@ -64,6 +64,8 @@ class TextNormalizer():
List[str]
Sentences.
"""
# Only for pure Chinese here
text = text.replace(" ", "")
text = self.SENTENCE_SPLITOR.sub(r'\1\n', text)
text = text.strip()
sentences = [sentence.strip() for sentence in re.split(r'\n+', text)]

Loading…
Cancel
Save