Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TTS]当文本中包含全角数字的时候会报错 #2566

Closed
arashrun opened this issue Oct 21, 2022 · 2 comments · Fixed by #2661
Closed

[TTS]当文本中包含全角数字的时候会报错 #2566

arashrun opened this issue Oct 21, 2022 · 2 comments · Fixed by #2661

Comments

@arashrun
Copy link

Describe the bug
文本包含全角数字报错

期望
正常转换

错误信息

special_tokens_map.json
Traceback (most recent call last):
  File "/home/like/tts/tts.py", line 8, in <module>
    tts(text=context, output="output.wav")
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/cli/utils.py", line 328, in _warpper
    return executor_func(self, *args, **kwargs)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/cli/tts/infer.py", line 684, in __call__
    self.infer(text=text, lang=lang, am=am, spk_id=spk_id)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddle/fluid/dygraph/base.py", line 354, in _decorate_function
    return func(*args, **kwargs)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/cli/tts/infer.py", line 445, in infer
    frontend_dict = run_frontend(
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/exps/syn_utils.py", line 183, in run_frontend
    input_ids = frontend.get_input_ids(
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 408, in get_input_ids
    phonemes = self.get_phonemes(
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 374, in get_phonemes
    sentences = self.text_normalizer.normalize(sentence)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py", line 115, in normalize
    sentences = [self.normalize_sentence(sent) for sent in sentences]
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py", line 115, in <listcomp>
    sentences = [self.normalize_sentence(sent) for sent in sentences]
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py", line 86, in normalize_sentence
    sentence = RE_DATE.sub(replace_date, sentence)
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/chronology.py", line 104, in replace_date
    result += f"{verbalize_digit(year)}年"
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/num.py", line 211, in verbalize_digit
    result_symbols = [DIGITS[digit] for digit in value_string]
  File "/home/like/.virtualenvs/tts/lib/python3.9/site-packages/paddlespeech/t2s/frontend/zh_normalization/num.py", line 211, in <listcomp>
    result_symbols = [DIGITS[digit] for digit in value_string]
KeyError: ''
@yt605155624
Copy link
Collaborator

感谢反馈,可以在 TN 里面找个地方加个全角转半角的逻辑,应该不难,欢迎提交修复 pr 🌹🌹🌹

@yt605155624
Copy link
Collaborator

@arashrun 我们有全角半角的映射表,可以尝试下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants