Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
ed0138c6
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
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看板
提交
ed0138c6
编写于
10月 20, 2022
作者:
D
david.95
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add condition check if a ssml input and filter space line, test=tts
上级
21cce0e0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
13 deletion
+23
-13
paddlespeech/t2s/exps/syn_utils.py
paddlespeech/t2s/exps/syn_utils.py
+23
-13
未找到文件。
paddlespeech/t2s/exps/syn_utils.py
浏览文件 @
ed0138c6
...
...
@@ -105,14 +105,15 @@ def get_sentences(text_file: Optional[os.PathLike], lang: str='zh'):
sentences
=
[]
with
open
(
text_file
,
'rt'
)
as
f
:
for
line
in
f
:
items
=
re
.
split
(
r
"\s+"
,
line
.
strip
(),
1
)
utt_id
=
items
[
0
]
if
lang
==
'zh'
:
sentence
=
""
.
join
(
items
[
1
:])
elif
lang
==
'en'
:
sentence
=
" "
.
join
(
items
[
1
:])
elif
lang
==
'mix'
:
sentence
=
" "
.
join
(
items
[
1
:])
if
line
.
strip
()
!=
""
:
items
=
re
.
split
(
r
"\s+"
,
line
.
strip
(),
1
)
utt_id
=
items
[
0
]
if
lang
==
'zh'
:
sentence
=
""
.
join
(
items
[
1
:])
elif
lang
==
'en'
:
sentence
=
" "
.
join
(
items
[
1
:])
elif
lang
==
'mix'
:
sentence
=
" "
.
join
(
items
[
1
:])
sentences
.
append
((
utt_id
,
sentence
))
return
sentences
...
...
@@ -182,11 +183,20 @@ def run_frontend(frontend: object,
to_tensor
:
bool
=
True
):
outs
=
dict
()
if
lang
==
'zh'
:
input_ids
=
frontend
.
get_input_ids_ssml
(
text
,
merge_sentences
=
merge_sentences
,
get_tone_ids
=
get_tone_ids
,
to_tensor
=
to_tensor
)
input_ids
=
{}
if
text
.
strip
()
!=
""
and
re
.
match
(
r
".*?<speak>.*?</speak>.*"
,
text
,
re
.
DOTALL
):
input_ids
=
frontend
.
get_input_ids_ssml
(
text
,
merge_sentences
=
merge_sentences
,
get_tone_ids
=
get_tone_ids
,
to_tensor
=
to_tensor
)
else
:
input_ids
=
frontend
.
get_input_ids
(
text
,
merge_sentences
=
merge_sentences
,
get_tone_ids
=
get_tone_ids
,
to_tensor
=
to_tensor
)
phone_ids
=
input_ids
[
"phone_ids"
]
if
get_tone_ids
:
tone_ids
=
input_ids
[
"tone_ids"
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录