代码拉取完成,页面将自动刷新
#!/bin/bash
# Copyright xmuspeech (Author: Snowdar 2019-10-17)
nj=10
. subtools/parse_options.sh
. subtools/linux/functions.sh
. subtools/path.sh
set -e
if [[ $# != 1 ]];then
echo "[exit] Num of parameters is not equal to 1"
echo "usage:$0 <data-dir>"
exit 1
fi
data=$1
[ ! -d $data ] && echo "[exit] No such dir $data." && exit 1
[ ! -f $data/feats.scp ] && echo "[exit] Expected $data/feats.scp to exist" && exit 1
# Check
num=$(wc -l $data/feats.scp | awk '{print $1}')
rm -f $data/.error
if [ -f $data/utt2num_frames ];then
awk -v num=$num -v data=$data '{if(NF!=2){print $1 > data"/.error"}}
END{if(NR!=num){print $1 > data"/.error"}}' $data/utt2num_frames
[ ! -f $data/.error ] && echo "[Note] The file $data/utt2num_frames is exist, so do not generate it again." && exit 0
[ -f $data/.error ] && echo "[Warning] There is an error in $data/utt2num_frames, so generate it again."
fi
function feat_to_len(){
feat-to-len scp:$1 ark,t:$2
return 0
}
echo "Generate $data/utt2num_frames according to $data/feats.scp"
do_lines_task_parallel --nj $nj feat_to_len $data/feats.scp $data/utt2num_frames
echo "Get $data/utt2num_frames done"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。