#!/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的更多相关文章

  1. 数据库备份并分离日志表(按月)sh 脚本

    #!/bin/sh year=`date +%Y` month=`date +%m` day=`date +%d` hour=`date +%H` dir="/data/dbbackup/f ...

  2. Linux下如何查找.sh后缀的文件

    find / -name *.sh或locate *.shfind 与locate的区别:locate 配合数据库查看文件位置 find 实际搜寻硬盘查询文件名称

  3. sh 测试网段在线主机

    yum install nmap nmap -sP  192.168.21.1/24 查看网段在线主机 grep -vwf file1 file2 文件内容比较 #!/bin/bash # day=` ...

  4. Maven打包生成可运行bat/sh脚本文件

    利用Maven的appassembler-maven-plugin插件,就可以实现自动打包可运行的脚本,还可以跨平台.   <plugin>      <groupId>org ...

  5. 记一个简单的保护if 的sh脚本

    真是坑爹,就下面的sh,竟然也写了很久! if [ `pwd` != '/usr/xx/bin/tomcat' ] then echo "rstall is not allowed in c ...

  6. 主机巡检脚本:OSWatcher.sh

    主机巡检脚本:OSWatcher.sh 2016-09-26更新,目前该脚本只支持Linux操作系统,后续有需求可以继续完善. 注意: 经测试,普通用户执行脚本可以顺利执行前9项检查: 第10项,普通 ...

  7. Oracle巡检脚本:ORAWatcher.sh

    Oracle巡检脚本:ORAWatcher.sh #!/usr/bin/ksh echo "" echo "ORAWatcher Version:1.0.1" ...

  8. 解决:/bin/sh: 1: /home/**/custom_app.sh: Permission denied错误

    出现如下错误,一般是执行权限不够. /bin/sh: : /home/custom_app.sh: Permission denied 解决方法是:cd 到此文件目录,对提示的文件赋予可执行权限或读写 ...

  9. SH Script Grammar

    http://linux.about.com/library/cmd/blcmdl1_sh.htm http://pubs.opengroup.org/onlinepubs/9699919799/ut ...

随机推荐

  1. SQLAchemy模块

    老师的博客:http://www.cnblogs.com/wupeiqi/articles/5713330.html 有一篇习详细的博客: http://www.keakon.net/2012/12/ ...

  2. 练习 python之数据库增删改查

    # 文件存储时可以这样表示 ## id,name,age,phone,dept,enroll_date# 1,Alex Li,22,13651054608,IT,2013-04-01# 2,Jack ...

  3. Luogu P5283 [十二省联考2019]异或粽子

    感觉不是很难的一题,想了0.5h左右(思路歪了,不过想了一个大常数的两只\(\log\)做法233) 然后码+调了1h,除了一个SB的数组开小外基本上也没什么坑点 先讲一个先想到的方法,我们对于这种问 ...

  4. ABP之什么是ABP(ASP.NET Boilerplate)

    1.介绍 ABP是开源的且文档比较齐全的应用程序框架.其实它不仅仅是个框架,考虑其最佳实践,ABP更提供了基于领域驱动设计(DDD)的强大价格模型. ABP支持最新的ASP.NET Core和EF C ...

  5. 第二部分之Redis服务器(第十四章)

    Redis服务器复制和多个客户端建立网络连接,处理客户端发送的命令请求,在数据库中保存客户端执行命令所产生的数据. 一,命令请求的执行过程 客户端向服务器发送命令请求 set key value 服务 ...

  6. pytorch错误:Missing key(s) in state_dict、Unexpected key(s) in state_dict解决

    版权声明:本文为博主原创文章,欢迎转载,并请注明出处.联系方式:460356155@qq.com 在模型训练时加上: model = nn.DataParallel(model)cudnn.bench ...

  7. NodeJs之服务搭建与数据库连接

    NodeJs之服务搭建与数据库连接 一,介绍与需求分析 1.1,介绍 Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. Node.js 使用了一个事件驱动.非阻 ...

  8. K3CLOUDJOBPROCESS每分钟重启

    1.进入服务,找到k3cloudjobprocess 2.设置每分钟重启

  9. redis 连接idea一直被拒绝

    网上查找的方法 方法一:idea中已经下载了Iedis 插件, 也导入了jar包 <!-- https://mvnrepository.com/artifact/commons-pool/com ...

  10. gRPC源码分析(c++)

    首先需要按照grpc官网上说的办法从github上下载源码,编译,然后跑一跑对应的测试代码.我分析的代码版本为v1.20.0. 在cpp的helloworld例子中,client端,第一个函数是创建c ...