From 187858c91f046eddcaf96adf920fa6b6cbb1748f Mon Sep 17 00:00:00 2001 From: Xingyu Na Date: Wed, 20 Jul 2016 14:59:01 +0800 Subject: [PATCH] update score_sclite.sh --- egs/fisher_swbd/s5/local/score_sclite.sh | 50 ++++++++++++------------ egs/swbd/s5c/local/score_sclite.sh | 7 +--- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/egs/fisher_swbd/s5/local/score_sclite.sh b/egs/fisher_swbd/s5/local/score_sclite.sh index a5ac4932e59..b4cbad78e75 100755 --- a/egs/fisher_swbd/s5/local/score_sclite.sh +++ b/egs/fisher_swbd/s5/local/score_sclite.sh @@ -39,36 +39,38 @@ for f in $data/stm $data/glm $lang/words.txt $lang/phones/word_boundary.int \ [ ! -f $f ] && echo "$0: expecting file $f to exist" && exit 1; done +align_word= +reorder_opt= +if $reverse; then + align_word="lattice-reverse ark:- ark:- |" + reorder_opt="--reorder=false" +fi + +if [ -f $dir/../frame_shift ]; then + frame_shift_opt="--frame-shift=$(cat $dir/../frame_shift)" + echo "$0: $dir/../frame_shift exists, using $frame_shift_opt" +elif [ -f $dir/../frame_subsampling_factor ]; then + factor=$(cat $dir/../frame_subsampling_factor) || exit 1 + frame_shift_opt="--frame-shift=0.0$factor" + echo "$0: $dir/../frame_subsampling_factor exists, using $frame_shift_opt" +fi + name=`basename $data`; # e.g. eval2000 mkdir -p $dir/scoring/log if [ $stage -le 0 ]; then for wip in $(echo $word_ins_penalty | sed 's/,/ /g'); do - if $reverse; then - $cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/get_ctm.LMWT.${wip}.log \ - mkdir -p $dir/score_LMWT_${wip}/ '&&' \ - lattice-scale --lm-scale==LMWT "ark:gunzip -c $dir/lat.*.gz|" ark:- \|\ - lattice-add-penalty --word-ins-penalty=$wip ark:- ark:- \| \ - lattice-1best ark:- ark:- \| \ - lattice-reverse ark:- ark:- \| \ - lattice-align-words --reorder=false $lang/phones/word_boundary.int $model ark:- ark:- \| \ - nbest-to-ctm ark:- - \| \ - utils/int2sym.pl -f 5 $lang/words.txt \| \ - utils/convert_ctm.pl $data/segments $data/reco2file_and_channel \ - '>' $dir/score_LMWT_${wip}/$name.ctm || exit 1; - else - $cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/get_ctm.LMWT.${wip}.log \ - mkdir -p $dir/score_LMWT_${wip}/ '&&' \ - lattice-scale --lm-scale=LMWT "ark:gunzip -c $dir/lat.*.gz|" ark:- \| \ - lattice-add-penalty --word-ins-penalty=$wip ark:- ark:- \| \ - lattice-1best ark:- ark:- \| \ - lattice-align-words $lang/phones/word_boundary.int $model ark:- ark:- \| \ - nbest-to-ctm ark:- - \| \ - utils/int2sym.pl -f 5 $lang/words.txt \| \ - utils/convert_ctm.pl $data/segments $data/reco2file_and_channel \ - '>' $dir/score_LMWT_${wip}/$name.ctm || exit 1; - fi + $cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/get_ctm.LMWT.${wip}.log \ + mkdir -p $dir/score_LMWT_${wip}/ '&&' \ + lattice-scale --lm-scale=LMWT "ark:gunzip -c $dir/lat.*.gz|" ark:- \| \ + lattice-add-penalty --word-ins-penalty=$wip ark:- ark:- \| \ + lattice-1best ark:- ark:- \| \ + $align_word lattice-align-words $reorder_opts $lang/phones/word_boundary.int $model ark:- ark:- \| \ + nbest-to-ctm ark:- - \| \ + utils/int2sym.pl -f 5 $lang/words.txt \| \ + utils/convert_ctm.pl $data/segments $data/reco2file_and_channel \ + '>' $dir/score_LMWT_${wip}/$name.ctm || exit 1; done fi diff --git a/egs/swbd/s5c/local/score_sclite.sh b/egs/swbd/s5c/local/score_sclite.sh index 7ac33fdd26a..1e70ad281bf 100755 --- a/egs/swbd/s5c/local/score_sclite.sh +++ b/egs/swbd/s5c/local/score_sclite.sh @@ -40,10 +40,6 @@ for f in $data/stm $data/glm $lang/words.txt $lang/phones/word_boundary.int \ [ ! -f $f ] && echo "$0: expecting file $f to exist" && exit 1; done -name=`basename $data`; # e.g. eval2000 - -mkdir -p $dir/scoring/log - align_word= reorder_opt= if $reverse; then @@ -51,7 +47,6 @@ if $reverse; then reorder_opt="--reorder=false" fi - if [ -f $dir/../frame_shift ]; then frame_shift_opt="--frame-shift=$(cat $dir/../frame_shift)" echo "$0: $dir/../frame_shift exists, using $frame_shift_opt" @@ -72,7 +67,7 @@ if [ $stage -le 0 ]; then lattice-scale --lm-scale=LMWT "ark:gunzip -c $dir/lat.*.gz|" ark:- \| \ lattice-add-penalty --word-ins-penalty=$wip ark:- ark:- \| \ lattice-1best ark:- ark:- \| \ - lattice-align-words $reorder_opt $lang/phones/word_boundary.int $model ark:- ark:- \| \ + $align_word lattice-align-words $reorder_opt $lang/phones/word_boundary.int $model ark:- ark:- \| \ nbest-to-ctm $frame_shift_opt ark:- - \| \ utils/int2sym.pl -f 5 $lang/words.txt \| \ utils/convert_ctm.pl $data/segments $data/reco2file_and_channel \