Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
48207c14
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看板
提交
48207c14
编写于
11月 29, 2021
作者:
J
Junkun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
process scripts and configs
上级
ea35558e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
109 addition
and
0 deletion
+109
-0
examples/ted_en_zh/st1/conf/fbank.conf
examples/ted_en_zh/st1/conf/fbank.conf
+2
-0
examples/ted_en_zh/st1/conf/pitch.conf
examples/ted_en_zh/st1/conf/pitch.conf
+1
-0
examples/ted_en_zh/st1/local/ted_en_zh.py
examples/ted_en_zh/st1/local/ted_en_zh.py
+104
-0
examples/ted_en_zh/st1/steps
examples/ted_en_zh/st1/steps
+1
-0
examples/ted_en_zh/st1/utils
examples/ted_en_zh/st1/utils
+1
-0
未找到文件。
examples/ted_en_zh/st1/conf/fbank.conf
0 → 100644
浏览文件 @
48207c14
--
sample
-
frequency
=
16000
--
num
-
mel
-
bins
=
80
examples/ted_en_zh/st1/conf/pitch.conf
0 → 100644
浏览文件 @
48207c14
--
sample
-
frequency
=
16000
examples/ted_en_zh/st1/local/ted_en_zh.py
0 → 100644
浏览文件 @
48207c14
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
import
codecs
import
os
# org_split = 'train-split/train-segment'
# text_file = 'En-Zh/train.en-zh'
# data_split = 'train'
def
data_process
(
src_dir
,
tgt_dir
,
wav_dir_list
,
text_file_list
,
data_split_list
):
for
org_split
,
text_file
,
data_split
in
zip
(
wav_dir_list
,
text_file_list
,
data_split_list
):
local_data_split_dir
=
os
.
path
.
join
(
tgt_dir
,
data_split
)
os
.
makedirs
(
local_data_split_dir
,
exist_ok
=
True
)
utts
=
[]
utt2spk
=
{}
with
open
(
os
.
path
.
join
(
local_data_split_dir
,
'wav.scp.org'
),
'w'
)
as
wav_wf
,
\
open
(
os
.
path
.
join
(
local_data_split_dir
,
'utt2spk.org'
),
'w'
)
as
utt2spk_wf
:
for
files
in
os
.
listdir
(
os
.
path
.
join
(
src_dir
,
org_split
)):
files
=
files
.
strip
()
file_path
=
os
.
path
.
join
(
src_dir
,
org_split
,
files
)
size
=
os
.
path
.
getsize
(
file_path
)
if
size
<=
30000
:
continue
utt
=
files
.
split
(
'.'
)[
0
]
audio_name
=
utt
.
split
(
'_'
)[
0
]
#format the name of utterance
while
len
(
audio_name
)
<
6
:
utt
=
'0'
+
utt
audio_name
=
'0'
+
audio_name
utt
=
'ted-en-zh-'
+
utt
utts
.
append
(
utt
)
spk
=
utt
.
split
(
'_'
)[
0
]
utt2spk
[
utt
]
=
spk
assert
len
(
spk
)
==
16
,
"%r"
%
spk
print
(
utt
,
'cat'
,
os
.
path
.
abspath
(
file_path
),
'|'
,
file
=
wav_wf
)
for
utt
in
sorted
(
utts
):
print
(
utt
,
utt2spk
[
utt
],
file
=
utt2spk_wf
)
with
open
(
os
.
path
.
join
(
local_data_split_dir
,
'en.org'
),
'w'
)
as
en_wf
,
\
open
(
os
.
path
.
join
(
local_data_split_dir
,
'zh.org'
),
'w'
)
as
zh_wf
,
\
open
(
os
.
path
.
join
(
local_data_split_dir
,
'.yaml'
),
'w'
)
as
yaml_wf
,
\
codecs
.
open
(
os
.
path
.
join
(
src_dir
,
text_file
),
'r'
,
encoding
=
'utf-8'
,
errors
=
'ignore'
)
as
rf
:
count
=
0
for
line
in
rf
:
line
=
line
.
strip
()
line_spl
=
line
.
split
(
'
\t
'
)
assert
len
(
line_spl
)
==
3
,
"%r"
%
line
wav
,
en
,
zh
=
line_spl
assert
wav
.
endswith
(
'wav'
),
"%r"
%
wav
[
-
3
:]
utt
=
wav
.
split
(
'.'
)[
0
]
audio_name
=
utt
.
split
(
'_'
)[
0
]
while
len
(
audio_name
)
<
6
:
utt
=
'0'
+
utt
audio_name
=
'0'
+
audio_name
utt
=
'ted-en-zh-'
+
utt
print
(
utt
,
file
=
yaml_wf
)
print
(
en
.
lower
(),
file
=
en_wf
)
print
(
zh
,
file
=
zh_wf
)
count
+=
1
print
(
'%s set lines count: %d'
%
(
data_split
,
count
))
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
.
add_argument
(
"--src-dir"
,
default
=
""
,
type
=
str
,
help
=
"Directory to kaldi splited data. (default: %(default)s)"
)
parser
.
add_argument
(
"--tgt-dir"
,
default
=
"local/ted_en_zh"
,
type
=
str
,
help
=
"Directory to save processed data. (default: %(default)s)"
)
args
=
parser
.
parse_args
()
wav_dir_list
=
[
'train-split/train-segment'
,
'test-segment/tst2014'
,
'test-segment/tst2015'
]
text_file_list
=
[
'En-Zh/train.en-zh'
,
'En-Zh/tst2014.en-zh'
,
'En-Zh/tst2015.en-zh'
]
data_split_list
=
[
'train'
,
'dev'
,
'test'
]
data_process
(
args
.
src_dir
,
args
.
tgt_dir
,
wav_dir_list
,
text_file_list
,
data_split_list
)
examples/ted_en_zh/st1/steps
0 → 120000
浏览文件 @
48207c14
../../../tools/kaldi/egs/wsj/s5/steps
\ No newline at end of file
examples/ted_en_zh/st1/utils
0 → 120000
浏览文件 @
48207c14
../../../tools/kaldi/egs/wsj/s5/utils
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录