subset_lat_dir.sh
#!/bin/bash
# Copyright 2018 Jarvan Wang
# Copyright 2017 Vimal Manohar
# Apache 2.0.
cmd=run.pl
nj=40
if [ -f ./path.sh ]; then . ./path.sh; fi
. ./utils/parse_options.sh
if [ $# -ne 3 ]; then
cat <<EOF
This script creates an lattice directory containing a subset of
utterances contained in <subset-data-dir> from the
original lattice directory containing lattices for utterances in
<full-data-dir>.
The number of split jobs in the output lattice directory is
equal to the number of jobs in the original lattice directory,
unless the subset data directory has too few speakers.
Usage: $0 [options] <subset-data-dir> <lat-dir> <subset-lat-dir>
e.g.: $0 data/train exp/tri3_lat_sp exp/tri3_lat
Options:
--cmd (utils/run.pl|utils/queue.pl <queue opts>) # how to run jobs.
EOF
exit 1
fi
subset_data=$1
lat_dir=$2
dir=$3
ori_nj=$(cat $lat_dir/num_jobs) || exit 1
mkdir -p $dir
cp $lat_dir/{final.mdl,*.mat,*_opts,tree} $dir/ || true
cp -r $lat_dir/phones $dir 2>/dev/null || true
$cmd JOB=1:$ori_nj $dir/log/copy_lattices.JOB.log \
lattice-copy "ark:gunzip -c $lat_dir/lat.JOB.gz |" \
ark,scp:$dir/lat_tmp.JOB.ark,$dir/lat_tmp.JOB.scp || exit 1
for n in `seq $ori_nj`; do
cat $dir/lat_tmp.$n.scp
done > $dir/lat_tmp.scp
#awk '{hash[$1]=$2}END{for(key in hash){printf("%s %s\n",key,hash[key])}}' < $dir/lat_tmp.scp > $dir/lat_tmp_sorted_uniq.scp
mv $dir/lat_tmp.scp $dir/lat_tmp.scp.bak
perl -e 'my %hash;while(<>){chomp;($key,$ark)=split;$hash{$key}=$ark};for $key (sort keys %hash){printf("%s %s\n",$key,$hash{$key})}' $dir/lat_tmp.scp.bak > $dir/lat_tmp.scp
utils/split_data.sh $subset_data $nj
$cmd JOB=1:$nj $dir/log/filter_lattices.JOB.log \
lattice-copy \
"scp:utils/filter_scp.pl $subset_data/split${nj}/JOB/utt2spk $dir/lat_tmp.scp |" \
"ark:| gzip -c > $dir/lat.JOB.gz" || exit 1
echo $nj > $dir/num_jobs
#rm $dir/lat_tmp.*.{ark,scp} $dir/lat_tmp.scp
exit 0
subset_lat_dir.sh的更多相关文章
- 数据库备份并分离日志表(按月)sh 脚本
#!/bin/sh year=`date +%Y` month=`date +%m` day=`date +%d` hour=`date +%H` dir="/data/dbbackup/f ...
- Linux下如何查找.sh后缀的文件
find / -name *.sh或locate *.shfind 与locate的区别:locate 配合数据库查看文件位置 find 实际搜寻硬盘查询文件名称
- sh 测试网段在线主机
yum install nmap nmap -sP 192.168.21.1/24 查看网段在线主机 grep -vwf file1 file2 文件内容比较 #!/bin/bash # day=` ...
- Maven打包生成可运行bat/sh脚本文件
利用Maven的appassembler-maven-plugin插件,就可以实现自动打包可运行的脚本,还可以跨平台. <plugin> <groupId>org ...
- 记一个简单的保护if 的sh脚本
真是坑爹,就下面的sh,竟然也写了很久! if [ `pwd` != '/usr/xx/bin/tomcat' ] then echo "rstall is not allowed in c ...
- 主机巡检脚本:OSWatcher.sh
主机巡检脚本:OSWatcher.sh 2016-09-26更新,目前该脚本只支持Linux操作系统,后续有需求可以继续完善. 注意: 经测试,普通用户执行脚本可以顺利执行前9项检查: 第10项,普通 ...
- Oracle巡检脚本:ORAWatcher.sh
Oracle巡检脚本:ORAWatcher.sh #!/usr/bin/ksh echo "" echo "ORAWatcher Version:1.0.1" ...
- 解决:/bin/sh: 1: /home/**/custom_app.sh: Permission denied错误
出现如下错误,一般是执行权限不够. /bin/sh: : /home/custom_app.sh: Permission denied 解决方法是:cd 到此文件目录,对提示的文件赋予可执行权限或读写 ...
- SH Script Grammar
http://linux.about.com/library/cmd/blcmdl1_sh.htm http://pubs.opengroup.org/onlinepubs/9699919799/ut ...
随机推荐
- centos7 安装 pyspider 出现的一系列问题及解决方案集合
先安装python3 和 pip3 wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz 安装zlib-devel包(后面安装pi ...
- pytest生成测试报告-4种方法
1.生成resultlog文件 2.生成JunitXML文件 3.生成html测试报告 > pip install pytest-html # 通过pip安装pytest-html 4. ...
- vue 前端将时间戳格式化
转自西风XF : https://blog.csdn.net/qq_36242361/article/details/79143050 后端传过来的时间数据是时间戳的形式,前端需要进行格式化 1. 新 ...
- Git使用(积累一些常用的命令)
1. 取消某一次合并 git merge --abort 可以参考的教程:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248 ...
- 微信h5支付
分为 微信内H5调起支付 和 非微信浏览器H5支付. 1.H5支付(微信内) 参考链接:https://www.jianshu.com/p/6b9acdd10de6 2.JSAPI支付(非微信) 参考 ...
- Ubuntu安装Navicat 12 for MySQL
环境准备 要想运行Navicat,必须先安装Wine,这个可以使用下面的命令来安装Wine: ubuntu@ubuntu ~ $ sudo apt-get install wine-stable 安装 ...
- c++使用cmake创建dpdk项目
使用cmake创建dpdk 特别注意的时,链接dpdk库时,一定要使用 -Wl,--whole-archive 和 -Wl,--no-whole-archive 包含所有的静态库,注意,不要链接 li ...
- .net string类型集合转int集合
1.string集合转int集合 //string类型的集合 List<string> tempStr = new List<string>() { "21" ...
- 快速排序-python
- gulp 入门使用
gulp 入门使用 使用场景 相信大家在传统的开发模式下 都是 html + css + js 然后静态文件不经过任何处理 部署到服务器,这样会有很多漏洞例如: 1.在网站上查看F12 就可以看到 ...