Add JS test for streaming + metadata

This commit is contained in:
Reuben Morais 2020-05-06 12:04:17 +02:00
parent b0e0972b78
commit a02eddec38
2 changed files with 19 additions and 1 deletions

View File

@ -134,6 +134,11 @@ if (!args['stream']) {
stream.feedAudioContent(chunk); stream.feedAudioContent(chunk);
}); });
conversionStream.on('end', () => { conversionStream.on('end', () => {
if (args['extended']) {
let metadata = stream.finishStreamWithMetadata();
console.log(candidateTranscriptToString(metadata.transcripts[0]));
} else {
console.log(stream.finishStream()); console.log(stream.finishStream());
}
}); });
} }

View File

@ -519,6 +519,12 @@ run_js_streaming_inference_tests()
status=$? status=$?
set -e set -e
assert_correct_ldc93s1_lm "${phrase_pbmodel_withlm}" "$status" assert_correct_ldc93s1_lm "${phrase_pbmodel_withlm}" "$status"
set +e
phrase_pbmodel_withlm=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --stream --extended 2>${TASKCLUSTER_TMP_DIR}/stderr | tail -n 1)
status=$?
set -e
assert_correct_ldc93s1_lm "${phrase_pbmodel_withlm}" "$status"
} }
run_js_streaming_prod_inference_tests() run_js_streaming_prod_inference_tests()
@ -529,4 +535,11 @@ run_js_streaming_prod_inference_tests()
status=$? status=$?
set -e set -e
assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}" assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}"
local _bitrate=$1
set +e
phrase_pbmodel_withlm=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --stream --extended 2>${TASKCLUSTER_TMP_DIR}/stderr | tail -n 1)
status=$?
set -e
assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}"
} }