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 ...
随机推荐
- 我的第一个python web开发框架(37)——职位管理功能
对于职位管理,我们可以理解它为角色权限的管理,就像前面所说的一样,有了职位管理,后台管理系统绑定好对应的权限以后,新进员工.离职或岗位调整,管理员操作起来就非常的便捷了,只需要重新绑定对应职位就可以做 ...
- Django中使用极验Geetest滑动验证码
一,环境部署 1.创建一个django测试项目 此处省略... 二,文档部署 1.下载安装python对应的SDK 使用命令从Github导入完整项目:git clone https://github ...
- 03SpringBoot用JdbcTemplates访问Mysql
03SpringBoot用JdbcTemplates访问Mysql 文章指导 学习笔记 学习代码 初始化mysql -- create table `account` DROP TABLE `acco ...
- Spring自动注入之@Autowired、@Resource、@Inject
相同点: 三者都支持对spring bean的自动注入 不同点: ①Autowired按照类型进行注入( Bean bean = applicationContext.getBean(Bean.cla ...
- Azure DevOps
Azure DevOps https://azure.microsoft.com/zh-cn/services/devops/ It looks great!
- 正则 re模块
Python 正则表达式 re 模块 简介 正则表达式(regular expression)是可以匹配文本片段的模式.最简单的正则表达式就是普通字符串,可以匹配其自身.比如,正则表达式 ‘hello ...
- React Fullpage
之前项目需要,单独拿出来做了个demo 目前仅支持收尾加autoheight github地址:https://github.com/zlinggnilz/React-Fullpage
- html2canvas 识别 svg 解决方案
参考: 预览地址 http://jsfiddle.net/bv16o50f/1/ html <div class="visualization"> <svg xm ...
- 解析.DBC文件, 读懂CAN通信矩阵,实现车内信号仿真
通常我们拿到某个ECU的通信矩阵数据库文件,.dbc后缀名的文件. 直接使用CANdb++ Editor打开,可以很直观的读懂信号矩阵的信息,例如下图: 现在要把上图呈现的信号从.dbc文件中解析出来 ...
- nginx 配置详解(转)
nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行网站的发布处理,另外 ...