From 1e0ac0fb5c9f517e7325deb16004de1054454da7 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 29 Feb 2016 20:03:52 +0800 Subject: refactor kaldi_decode --- kaldi_decode/local/score.sh | 67 --------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100755 kaldi_decode/local/score.sh (limited to 'kaldi_decode/local/score.sh') diff --git a/kaldi_decode/local/score.sh b/kaldi_decode/local/score.sh deleted file mode 100755 index b18f350..0000000 --- a/kaldi_decode/local/score.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# Copyright 2012 Johns Hopkins University (Author: Daniel Povey) -# Apache 2.0 - -[ -f ./path.sh ] && . ./path.sh - -# begin configuration section. -cmd=run.pl -stage=0 -decode_mbr=true -reverse=false -word_ins_penalty=0.0 -min_lmwt=5 -max_lmwt=20 -#end configuration section. - -[ -f ./path.sh ] && . ./path.sh -. parse_options.sh || exit 1; - -if [ $# -ne 3 ]; then - echo "Usage: local/score.sh [--cmd (run.pl|queue.pl...)] " - echo " Options:" - echo " --cmd (run.pl|queue.pl...) # specify how to run the sub-processes." - echo " --stage (0|1|2) # start scoring script from part-way through." - echo " --decode_mbr (true/false) # maximum bayes risk decoding (confusion network)." - echo " --min_lmwt # minumum LM-weight for lattice rescoring " - echo " --max_lmwt # maximum LM-weight for lattice rescoring " - echo " --reverse (true/false) # score with time reversed features " - exit 1; -fi - -data=$1 -lang_or_graph=$2 -dir=$3 - -symtab=$lang_or_graph/words.txt - -for f in $symtab $dir/lat.1.gz $data/text; do - [ ! -f $f ] && echo "score.sh: no such file $f" && exit 1; -done - -mkdir -p $dir/scoring/log - -cat $data/text | sed 's:::g' | sed 's:::g' > $dir/scoring/test_filt.txt - -$cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/best_path.LMWT.log \ - lattice-scale --inv-acoustic-scale=LMWT "ark:gunzip -c $dir/lat.*.gz|" ark:- \| \ - lattice-add-penalty --word-ins-penalty=$word_ins_penalty ark:- ark:- \| \ - lattice-best-path --word-symbol-table=$symtab \ - ark:- ark,t:$dir/scoring/LMWT.tra || exit 1; - -if $reverse; then - for lmwt in `seq $min_lmwt $max_lmwt`; do - mv $dir/scoring/$lmwt.tra $dir/scoring/$lmwt.tra.orig - awk '{ printf("%s ",$1); for(i=NF; i>1; i--){ printf("%s ",$i); } printf("\n"); }' \ - <$dir/scoring/$lmwt.tra.orig >$dir/scoring/$lmwt.tra - done -fi - -# Note: the double level of quoting for the sed command -$cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/score.LMWT.log \ - cat $dir/scoring/LMWT.tra \| \ - utils/int2sym.pl -f 2- $symtab \| sed 's:\::g' \| \ - compute-wer --text --mode=present \ - ark:$dir/scoring/test_filt.txt ark,p:- ">&" $dir/wer_LMWT || exit 1; - -exit 0; -- cgit v1.2.3