Skip to content

Commit

Permalink
Merge pull request kaldi-asr#907 from naxingyu/update-score-sclite
Browse files Browse the repository at this point in the history
update score_sclite.sh
  • Loading branch information
danpovey authored Jul 20, 2016
2 parents 7d5cd46 + 187858c commit 59e4691
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
50 changes: 26 additions & 24 deletions egs/fisher_swbd/s5/local/score_sclite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 1 addition & 6 deletions egs/swbd/s5c/local/score_sclite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,13 @@ 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
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"
Expand All @@ -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 \
Expand Down

0 comments on commit 59e4691

Please sign in to comment.