Blame view
egs/tedlium/s5_r3/local/score_basic.sh
1.55 KB
8dcb6dfcb first commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
#!/bin/bash # Copyright 2012 Johns Hopkins University (Author: Daniel Povey) # Apache 2.0 [ -f ./path.sh ] && . ./path.sh # begin configuration section. cmd=run.pl min_lmwt=7 max_lmwt=17 #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...)] <data-dir> <lang-dir|graph-dir> <decode-dir>" echo " Options:" echo " --cmd (run.pl|queue.pl...) # specify how to run the sub-processes." echo " --min_lmwt <int> # minumum LM-weight for lattice rescoring " echo " --max_lmwt <int> # maximum LM-weight for lattice rescoring " 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 > $dir/scoring/test_filt.txt $cmd LMWT=$min_lmwt:$max_lmwt $dir/scoring/log/best_path.LMWT.log \ lattice-best-path --lm-scale=LMWT --word-symbol-table=$symtab \ "ark:gunzip -c $dir/lat.*.gz|" ark,t:$dir/scoring/LMWT.tra || exit 1; # 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:<unk>::g'" \| \ compute-wer --text --mode=present \ ark:$dir/scoring/test_filt.txt ark,p:- ">&" $dir/wer_LMWT || exit 1; # Show results for f in $dir/wer_*; do echo $f; egrep '(WER)|(SER)' < $f; done exit 0; |