Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
b7312e9f
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
206
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b7312e9f
编写于
11月 09, 2022
作者:
H
HuangLiangJie
提交者:
GitHub
11月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revised TN qualifier for measure notation, test=tts (#2629)
上级
f43d0260
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
1 deletion
+31
-1
examples/other/tn/data/textnorm_test_cases.txt
examples/other/tn/data/textnorm_test_cases.txt
+3
-1
paddlespeech/t2s/frontend/zh_normalization/quantifier.py
paddlespeech/t2s/frontend/zh_normalization/quantifier.py
+26
-0
paddlespeech/t2s/frontend/zh_normalization/text_normlization.py
...speech/t2s/frontend/zh_normalization/text_normlization.py
+2
-0
未找到文件。
examples/other/tn/data/textnorm_test_cases.txt
浏览文件 @
b7312e9f
...
...
@@ -122,4 +122,6 @@ iPad Pro的秒控键盘这次也推出白色版本。|iPad Pro的秒控键盘这
近期也一反常态地发表看空言论|近期也一反常态地发表看空言论
985|九八五
12~23|十二到二十三
12-23|十二到二十三
\ No newline at end of file
12-23|十二到二十三
25cm²|二十五平方厘米
25m|米
\ No newline at end of file
paddlespeech/t2s/frontend/zh_normalization/quantifier.py
浏览文件 @
b7312e9f
...
...
@@ -18,6 +18,25 @@ from .num import num2str
# 温度表达式,温度会影响负号的读法
# -3°C 零下三度
RE_TEMPERATURE
=
re
.
compile
(
r
'(-?)(\d+(\.\d+)?)(°C|℃|度|摄氏度)'
)
measure_dict
=
{
"cm2"
:
"平方厘米"
,
"cm²"
:
"平方厘米"
,
"cm3"
:
"立方厘米"
,
"cm³"
:
"立方厘米"
,
"cm"
:
"厘米"
,
"db"
:
"分贝"
,
"ds"
:
"毫秒"
,
"kg"
:
"千克"
,
"km"
:
"千米"
,
"m2"
:
"平方米"
,
"m²"
:
"平方米"
,
"m³"
:
"立方米"
,
"m3"
:
"立方米"
,
"ml"
:
"毫升"
,
"m"
:
"米"
,
"mm"
:
"毫米"
,
"s"
:
"秒"
}
def
replace_temperature
(
match
)
->
str
:
...
...
@@ -35,3 +54,10 @@ def replace_temperature(match) -> str:
unit
:
str
=
"摄氏度"
if
unit
==
"摄氏度"
else
"度"
result
=
f
"
{
sign
}{
temperature
}{
unit
}
"
return
result
def
replace_measure
(
sentence
)
->
str
:
for
q_notation
in
measure_dict
:
if
q_notation
in
sentence
:
sentence
=
sentence
.
replace
(
q_notation
,
measure_dict
[
q_notation
])
return
sentence
paddlespeech/t2s/frontend/zh_normalization/text_normlization.py
浏览文件 @
b7312e9f
...
...
@@ -46,6 +46,7 @@ from .phonecode import RE_TELEPHONE
from
.phonecode
import
replace_mobile
from
.phonecode
import
replace_phone
from
.quantifier
import
RE_TEMPERATURE
from
.quantifier
import
replace_measure
from
.quantifier
import
replace_temperature
...
...
@@ -91,6 +92,7 @@ class TextNormalizer():
sentence
=
RE_TIME
.
sub
(
replace_time
,
sentence
)
sentence
=
RE_TEMPERATURE
.
sub
(
replace_temperature
,
sentence
)
sentence
=
replace_measure
(
sentence
)
sentence
=
RE_FRAC
.
sub
(
replace_frac
,
sentence
)
sentence
=
RE_PERCENTAGE
.
sub
(
replace_percentage
,
sentence
)
sentence
=
RE_MOBILE_PHONE
.
sub
(
replace_mobile
,
sentence
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录