Skip to content

Commit 3947a4b

Browse files
committed
Modify code to conform to ShellCheck specifications
1 parent 40fa148 commit 3947a4b

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

egs/xbmu_amdo31/s5/cmd.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
# conf/queue.conf in http://kaldi-asr.org/doc/queue.html for more information,
1111
# or search for the string 'default_config' in utils/queue.pl or utils/slurm.pl.
1212

13-
export train_cmd=run.pl
14-
export decode_cmd=run.pl
15-
export mkgraph_cmd=run.pl
13+
export train_cmd="queue.pl --mem 2G"
14+
export decode_cmd="queue.pl --mem 4G"
15+
export mkgraph_cmd="queue.pl --mem 8G"

egs/xbmu_amdo31/s5/local/chain/tuning/run_tdnn_1a.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ common_egs_dir=
2727
xent_regularize=0.1
2828

2929
# End configuration section.
30-
echo "$0 $@" # Print the command line for logging
30+
echo "$0 $*" # Print the command line for logging
3131

3232
. ./cmd.sh
3333
. ./path.sh

egs/xbmu_amdo31/s5/local/chain/tuning/run_tdnn_2a.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ common_egs_dir=
2929
xent_regularize=0.1
3030

3131
# End configuration section.
32-
echo "$0 $@" # Print the command line for logging
32+
echo "$0 $*" # Print the command line for logging
3333

3434
. ./cmd.sh
3535
. ./path.sh

egs/xbmu_amdo31/s5/local/nnet3/run_ivector_common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ if [ $stage -le 4 ]; then
9090
temp_data_root=exp/nnet3${nnet3_affix}/diag_ubm
9191

9292
num_utts_total=$(wc -l <data/${train_set}_sp_hires_nopitch/utt2spk)
93-
num_utts=$[$num_utts_total/4]
93+
num_utts=$((num_utts_total/4))
9494
utils/data/subset_data_dir.sh data/${train_set}_sp_hires_nopitch \
9595
$num_utts ${temp_data_root}/${train_set}_sp_hires_nopitch_subset
9696

egs/xbmu_amdo31/s5/local/nnet3/tuning/run_tdnn_1a.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if [ $stage -le 9 ]; then
105105
# this version of the decoding treats each utterance separately
106106
# without carrying forward speaker information.
107107
for decode_set in dev test; do
108-
num_jobs=`cat data/${decode_set}_hires/utt2spk|cut -d' ' -f2|sort -u|wc -l`
108+
num_jobs=$(cat data/${decode_set}_hires/utt2spk|cut -d' ' -f2|sort -u|wc -l)
109109
decode_dir=${dir}/decode_$decode_set
110110
steps/nnet3/decode.sh --nj $num_jobs --cmd "$decode_cmd" \
111111
--online-ivector-dir exp/nnet3/ivectors_${decode_set} \

egs/xbmu_amdo31/s5/local/nnet3/tuning/run_tdnn_2a.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ if [ $stage -le 9 ]; then
103103
# this version of the decoding treats each utterance separately
104104
# without carrying forward speaker information.
105105
for decode_set in dev test; do
106-
num_jobs=`cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l`
106+
num_jobs=$(cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l)
107107
decode_dir=${dir}/decode_$decode_set
108108
steps/nnet3/decode.sh --nj $num_jobs --cmd "$decode_cmd" \
109109
--online-ivector-dir exp/nnet3/ivectors_${decode_set} \
@@ -121,7 +121,8 @@ if [ $stage -le 11 ]; then
121121
# do the actual online decoding with iVectors, carrying info forward from
122122
# previous utterances of the same speaker.
123123
for decode_set in dev test; do
124-
num_jobs=`cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l`
124+
# num_jobs=`cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l`
125+
num_jobs=$(cat "data/${decode_set}_hires_online/utt2spk" | cut -d' ' -f2 | sort -u | wc -l)
125126
decode_dir=${dir}_online/decode_$decode_set
126127
steps/online/nnet3/decode.sh --nj $num_jobs --cmd "$decode_cmd" \
127128
--config conf/decode.config \
@@ -133,7 +134,8 @@ if [ $stage -le 12 ]; then
133134
# this version of the decoding treats each utterance separately
134135
# without carrying forward speaker information.
135136
for decode_set in dev test; do
136-
num_jobs=`cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l`
137+
# num_jobs=`cat data/${decode_set}_hires_online/utt2spk|cut -d' ' -f2|sort -u|wc -l`
138+
num_jobs=$(cat "data/${decode_set}_hires_online/utt2spk" | cut -d' ' -f2 | sort -u | wc -l)
137139
decode_dir=${dir}_online/decode_${decode_set}_per_utt
138140
steps/online/nnet3/decode.sh --nj $num_jobs --cmd "$decode_cmd" \
139141
--config conf/decode.config --per-utt true \

egs/xbmu_amdo31/s5/local/xbmu_amdo31_data_prep.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
echo $tibetan_audio_dir
3434
# find wav audio file for train, dev and test resp.
3535
find $tibetan_audio_dir -iname "*.wav" > $tmp_dir/wav.flist
36-
n=`cat $tmp_dir/wav.flist | wc -l`
36+
n=$(wc -l < "$tmp_dir/wav.flist")
3737
[ $n -ne 22630 ] && \
3838
echo Warning: expected 141925 data data files, found $n
3939

@@ -49,13 +49,13 @@ for dir in $train_dir $dev_dir $test_dir; do
4949
sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{print $NF}' > $dir/utt.list
5050
sed -e 's/\.wav//' $dir/wav.flist | awk -F '/' '{i=NF-1;printf("%s %s\n",$NF,$i)}'> $dir/utt2spk_all
5151
rm -f $dir/transcripts1.txt
52-
cat $dir/utt.list |while read line
52+
while read -r line
5353
do
54-
line1=`echo $line |cut -d "-" -f 2`
55-
line2=`grep -w $line1 $tibetan_text |cut -d " " -f 2-`
54+
line1=$(echo "$line" | cut -d '-' -f 2)
55+
line2=$(grep -w $line1 $tibetan_text |cut -d " " -f 2-)
5656
text=$line" "$line2
5757
echo $text >>$dir/transcripts1.txt
58-
done
58+
done < "$dir/utt.list"
5959
paste -d' ' $dir/utt.list $dir/wav.flist > $dir/wav.scp_all
6060
utils/filter_scp.pl -f 1 $dir/utt.list $dir/transcripts1.txt > $dir/transcripts.txt
6161
awk '{print $1}' $dir/transcripts.txt > $dir/utt.list

egs/xbmu_amdo31/s5/local/xbmu_amdo31_train_lms.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ done
1919
dir=data/local/lm
2020
mkdir -p $dir
2121

22-
kaldi_lm=`which train_lm.sh`
22+
kaldi_lm=$(command -v train_lm.sh)
2323
if [ -z $kaldi_lm ]; then
2424
echo "$0: train_lm.sh is not found. That might mean it's not installed"
2525
echo "$0: or it is not added to PATH"

egs/xbmu_amdo31/s5/path.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export KALDI_ROOT=`pwd`/../../..
1+
export KALDI_ROOT=$(pwd)/../../..
22
[ -f $KALDI_ROOT/tools/env.sh ] && . $KALDI_ROOT/tools/env.sh
33
export PATH=$PWD/utils/:$KALDI_ROOT/tools/openfst/bin:$PWD:$PATH
44
[ ! -f $KALDI_ROOT/tools/config/common_path.sh ] && echo >&2 "The standard file $KALDI_ROOT/tools/config/common_path.sh is not present -> Exit!" && exit 1

0 commit comments

Comments
 (0)