diff --git a/egs/wsj/s5/steps/rnnlmrescore.sh b/egs/wsj/s5/steps/rnnlmrescore.sh index c1302e2beed..1e7a58e91c5 100755 --- a/egs/wsj/s5/steps/rnnlmrescore.sh +++ b/egs/wsj/s5/steps/rnnlmrescore.sh @@ -107,8 +107,10 @@ if [ "$oldlm" == "$oldlang/G.fst" ]; then # if the old LM scores were added e.g. by lmrescore.sh, using # phi-matcher composition. $cmd JOB=1:$nj $dir/log/remove_old.JOB.log \ - lattice-compose --phi-label=$phi "ark:gunzip -c $dir/nbest1.JOB.gz|" $oldlm \ - "ark:|gzip -c >$dir/nbest2.JOB.gz" || exit 1; + lattice-scale --acoustic-scale=-1 --lm-scale=-1 "ark:gunzip -c $dir/nbest1.JOB.gz|" ark:- \| \ + lattice-compose --phi-label=$phi ark:- $oldlm ark:- \| \ + lattice-scale --acoustic-scale=-1 --lm-scale=-1 ark:- "ark:|gzip -c >$dir/nbest2.JOB.gz" \ + || exit 1; fi else if [ $stage -le 2 ]; then diff --git a/egs/wsj/s5/utils/rnnlm_compute_scores.sh b/egs/wsj/s5/utils/rnnlm_compute_scores.sh index 75c4c262c49..060b645aca3 100755 --- a/egs/wsj/s5/utils/rnnlm_compute_scores.sh +++ b/egs/wsj/s5/utils/rnnlm_compute_scores.sh @@ -62,8 +62,16 @@ cat $tempdir/text | awk -v voc=$dir/wordlist.rnn -v unk=$dir/unk.probs \ # OK, now we compute the scores on the text with OOVs replaced # with -$rnnlm -independent -rnnlm $dir/rnnlm -test $tempdir/text.nounk -nbest -debug 0 | \ - awk '{print $1*log(10);}' > $tempdir/loglikes.rnn +if [ $rnnlm_ver == "faster-rnnlm" ]; then + $rnnlm -independent -rnnlm $dir/rnnlm -test $tempdir/text.nounk -nbest -debug 0 | \ + awk '{print $1*log(10);}' > $tempdir/loglikes.rnn +else + # add the utterance_id as required by Mikolove's rnnlm + paste $tempdir/ids $tempdir/text.nounk > $tempdir/id_text.nounk + + $rnnlm -independent -rnnlm $dir/rnnlm -test $tempdir/id_text.nounk -nbest -debug 0 | \ + awk '{print $1*log(10);}' > $tempdir/loglikes.rnn +fi [ `cat $tempdir/loglikes.rnn | wc -l` -ne `cat $tempdir/loglikes.oov | wc -l` ] && \ echo "rnnlm rescoring failed" && exit 1;