From a02eddec385ab95d8f746ad570a670586e2ad87c Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Wed, 6 May 2020 12:04:17 +0200 Subject: [PATCH] Add JS test for streaming + metadata --- native_client/javascript/client.ts | 7 ++++++- taskcluster/tc-asserts.sh | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/native_client/javascript/client.ts b/native_client/javascript/client.ts index ecf00a95..d607060e 100644 --- a/native_client/javascript/client.ts +++ b/native_client/javascript/client.ts @@ -134,6 +134,11 @@ if (!args['stream']) { stream.feedAudioContent(chunk); }); conversionStream.on('end', () => { - console.log(stream.finishStream()); + if (args['extended']) { + let metadata = stream.finishStreamWithMetadata(); + console.log(candidateTranscriptToString(metadata.transcripts[0])); + } else { + console.log(stream.finishStream()); + } }); } diff --git a/taskcluster/tc-asserts.sh b/taskcluster/tc-asserts.sh index 62f1e8ff..a56a4c49 100755 --- a/taskcluster/tc-asserts.sh +++ b/taskcluster/tc-asserts.sh @@ -519,6 +519,12 @@ run_js_streaming_inference_tests() status=$? set -e 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() @@ -529,4 +535,11 @@ run_js_streaming_prod_inference_tests() status=$? set -e 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}" }