Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
F
Fairseq-S2T
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
xuchen
Fairseq-S2T
Commits
9452b069
Commit
9452b069
authored
Jul 19, 2022
by
xuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the shell scripts
parent
a598692d
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
87 行增加
和
0 行删除
+87
-0
egs/aishell/asr/local/cal_ctc_bleu.sh
+23
-0
egs/aishell/asr/local/cal_wer.py
+47
-0
egs/aishell/asr/local/cal_wer.sh
+17
-0
没有找到文件。
egs/aishell/asr/local/cal_ctc_bleu.sh
0 → 100644
查看文件 @
9452b069
set
-e
infer_dir
=
$1
tag
=
$2
s2s_infer_file
=
${
infer_dir
}
/
$3
org_ctc_infer_file
=
${
infer_dir
}
/
$4
ref
=
$5
tokenizer
=
$6
lang
=
$7
idx
=
${
infer_dir
}
/
${
tag
}
_idx
ctc_infer
=
${
infer_dir
}
/
${
tag
}
_ctc_infer
ctc_infer_sort
=
${
infer_dir
}
/
${
tag
}
_ctc_infer_sort
if
[[
!
-f
${
ctc_infer_sort
}
]]
;
then
cut
-f1
${
s2s_infer_file
}
>
${
idx
}
paste
${
idx
}
${
org_ctc_infer_file
}
>
${
ctc_infer
}
sort
-n
-t
$'
\t
'
${
ctc_infer
}
| cut
-f2
>
${
ctc_infer_sort
}
fi
gen
=
${
ctc_infer_sort
}
./cal_bleu.sh
${
ref
}
${
gen
}
${
tokenizer
}
${
lang
}
\ No newline at end of file
egs/aishell/asr/local/cal_wer.py
0 → 100644
查看文件 @
9452b069
import
unicodedata
import
jiwer
import
jiwer.transforms
as
tr
import
sys
ref_file
=
sys
.
argv
[
1
]
hyp_file
=
sys
.
argv
[
2
]
wer_standardize
=
tr
.
Compose
(
[
tr
.
SubstituteRegexes
({
r"<<unk>>"
:
r"@"
}),
tr
.
ToLowerCase
(),
tr
.
RemovePunctuation
(),
tr
.
ExpandCommonEnglishContractions
(),
tr
.
RemoveKaldiNonWords
(),
tr
.
RemoveWhiteSpace
(
replace_by_space
=
True
),
tr
.
ReduceToListOfListOfWords
(),
]
)
cer_standardize
=
tr
.
Compose
(
[
tr
.
SubstituteRegexes
({
r"<<unk>>"
:
r"@"
}),
tr
.
ToLowerCase
(),
tr
.
RemovePunctuation
(),
tr
.
Strip
(),
tr
.
ReduceToListOfListOfChars
(),
]
)
ref_lines
=
open
(
ref_file
,
"r"
)
.
readlines
()
hyp_lines
=
open
(
hyp_file
,
"r"
)
.
readlines
()
wer
=
jiwer
.
wer
(
ref_lines
,
hyp_lines
,
truth_transform
=
wer_standardize
,
hypothesis_transform
=
wer_standardize
,
)
cer
=
jiwer
.
cer
(
ref_lines
,
hyp_lines
,
truth_transform
=
cer_standardize
,
hypothesis_transform
=
cer_standardize
,
)
print
(
"WER:
%.4
f"
%
wer
)
print
(
"CER:
%.4
f"
%
cer
)
egs/aishell/asr/local/cal_wer.sh
0 → 100644
查看文件 @
9452b069
set
-e
infer_dir
=
$1
tag
=
$2
s2s_infer_file
=
${
infer_dir
}
/
$3
org_ctc_infer_file
=
${
infer_dir
}
/
$4
ref
=
$5
idx
=
${
infer_dir
}
/
${
tag
}
_idx
ctc_infer
=
${
infer_dir
}
/
${
tag
}
_ctc_infer
ctc_infer_sort
=
${
infer_dir
}
/
${
tag
}
_ctc_infer_sort
cut
-f1
${
s2s_infer_file
}
>
${
idx
}
paste
${
idx
}
${
org_ctc_infer_file
}
>
${
ctc_infer
}
sort
-n
-t
$'
\t
'
${
ctc_infer
}
| cut
-f2
>
${
ctc_infer_sort
}
python3 ./cal_wer.py
${
ref
}
${
ctc_infer_sort
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论