INNER CODE UNIT · Python
has_english_punctuation
netease-youdao/EmotiVoice · frontend_cn.py:80
def has_english_punctuation(text):
return text in string.punctuation
# with thanks to KimigaiiWuyi in https://github.com/netease-youdao/EmotiVoice/pull/17.
# Updated on November 20, 2023: EmotiVoice now incorporates cn2an (https://github.com/Ailln/cn2an) for number processing.
re_digits = re.compile('(\d[\d\.]*)')
def number_to_chinese(number):
an2cn = An2Cn()
result = an2cn.an2cn(number)
return result
def tn_chinese(text):
parts = re_digits.split(text)
words = []
for part in parts:
if re_digits.match(part):
words.append(number_to_chinese(part))