diff --git a/doxygen/pocketsphinx_batch.1 b/doxygen/pocketsphinx_batch.1 index 8e660af8..ba59fa6d 100644 --- a/doxygen/pocketsphinx_batch.1 +++ b/doxygen/pocketsphinx_batch.1 @@ -369,6 +369,9 @@ Silence word transition probability .B \-smoothspec Write out cepstral-smoothed logspectral files .TP +.B \-stream_reset +Reset noise-removal statistics before each control-file entry, for control files whose entries are independent recordings +.TP .B \-svspec specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38) .TP diff --git a/programs/pocketsphinx_batch.c b/programs/pocketsphinx_batch.c index 3a1ae210..d904d3fc 100644 --- a/programs/pocketsphinx_batch.c +++ b/programs/pocketsphinx_batch.c @@ -79,6 +79,10 @@ static const ps_arg_t ps_args_def[] = { ARG_INTEGER, "1", "Do every Nth line in the control file" }, + { "stream_reset", + ARG_BOOLEAN, + "no", + "Reset noise-removal statistics before each control-file entry, for control files whose entries are independent recordings" }, { "mllrctl", ARG_STRING, NULL, @@ -836,6 +840,9 @@ process_ctl(ps_decoder_t *ps, cmd_ln_t *config, FILE *ctlfh) E_INFO("Decoding '%s'\n", uttid); /* Do actual decoding. */ + if (ps_config_bool(config, "stream_reset") + && ps_config_bool(config, "remove_noise")) + ps_start_stream(ps); if(process_mllrctl_line(ps, config, mllrfile) < 0) continue; if(process_lmnamectl_line(ps, config, lmname) < 0) diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt index 4ef434d5..56ca37fa 100644 --- a/test/regression/CMakeLists.txt +++ b/test/regression/CMakeLists.txt @@ -3,6 +3,7 @@ set(TESTS test-lm.sh test-lm-convert.sh test-main.sh + test-batch-stream-reset.sh test-main-align.sh test-align.sh test-tidigits-fsg.sh diff --git a/test/regression/test-batch-stream-reset.sh b/test/regression/test-batch-stream-reset.sh new file mode 100644 index 00000000..7dcfde16 --- /dev/null +++ b/test/regression/test-batch-stream-reset.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +: ${CMAKE_BINARY_DIR:=$(pwd)} +. ${CMAKE_BINARY_DIR}/test/testfuncs.sh + +bn=`basename $0 .sh` +ctl=$bn.ctl + +echo "Test: $bn" + +printf 'goforward 0 -1 gof_first\nnumbers 0 -1 num\nsomething 0 -1 som\ngoforward 0 -1 gof_again\n' >$ctl +rm -f $bn.hyp + +run_program pocketsphinx_batch \ + -hmm $model/en-us/en-us \ + -lm $model/en-us/en-us.lm.bin \ + -dict $model/en-us/cmudict-en-us.dict \ + -ctl $ctl \ + -cepdir $data \ + -cepext .raw \ + -adcin yes \ + -stream_reset yes \ + -hyp $bn.hyp \ + 2>$bn.log + +if [ $? = 0 ]; then + pass "run" +else + fail "run" +fi + +first=`grep ' (gof_first ' $bn.hyp 2>/dev/null | sed 's/ (gof_first / (gof /'` +again=`grep ' (gof_again ' $bn.hyp 2>/dev/null | sed 's/ (gof_again / (gof /'` + +if test -n "$first" && test "$first" = "$again"; then + pass "repeated entry" +else + fail "repeated entry" +fi