#!/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. hadoop wordcout测试

    hadoop wordcout测试 安装好hadoop 环境后,启动HDFS等服务:输密码 1004 start-all.sh 查看启动情况 1006 jps 1007 cd ~ 切换到用户默认目录 ...

  2. EF Core使用笔记(基于MySql数据库)

    一.什么是EF Entity Framework 是适用于.NET 的对象关系映射程序 (O/RM). 二.比较 EF Core 和 EF6 1.Entity Framework 6 Entity F ...

  3. windows10 uwp获取设备当前地理位置(经纬度)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  4. Divide Candies CodeForces - 1056B (数学)

    Arkady and his friends love playing checkers on an n×nn×n field. The rows and the columns of the fie ...

  5. Java规则之条件语句中做空判断时使用||和&&常犯的错误

    错误代码示例: public String bar(String string) { //error 1 if (string!=null || !string.equals("" ...

  6. dpdk-18.11网卡多队列RSS设置

    背景 最近在做将基于dpdk-16.11.1开发的程序,转移到基于dpdk-18.11版本下开发.遇到了网卡RSS配置的问题,在这里纪录一下. 问题 dpdk-16.11.1 在dpdk-16.11. ...

  7. telnet-server、telnet

    1.查询yum仓库中的安装包 [root@localhost /]# yum list |grep telnettelnet.x86_64                              1 ...

  8. java的clone()方法

    什么是"clone"? 在实际编程过程中,我们常常要遇到这种情况:有一个对象A,在某一时刻A中已经包含了一些有效值,此时可能 会需要一个和A完全相同新对象B,并且此后对B任何改动都 ...

  9. CountDownLatch类实现同步

    首先我们看一个普通的多线程代码 class MyThread implements Runnable { @Override public void run() { System.out.printl ...

  10. 【长期更新】迈向现代化的 .Net 配置指北

    1. 欢呼 .NET Standard 时代 我现在已不大提 .Net Core,对于我来说,未来的开发将是基于 .NET Standard,不仅仅是 面向未来 ,也是 面向过去:不只是 .Net C ...