Skip to content

Commit

Permalink
rm space for pure Chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
yt605155624 authored and root committed Nov 26, 2021
1 parent dad1cbb commit a861e56
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion demos/style_fs2/style_syn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/exps/fastspeech2/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/exps/speedyspeech/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions paddlespeech/t2s/frontend/zh_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def _g2p(self,
# 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def _split(self, text: str) -> List[str]:
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)]
Expand Down

0 comments on commit a861e56

Please sign in to comment.