From 1a006159d6c8807933abb1af86813dd54a595405 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 12 Dec 2016 13:26:04 -0500 Subject: [PATCH] add list of supported language models --- recipes/conversation/conversation.js | 26 +++++++++++++++++++++++--- recipes/speech_to_text/stt.js | 5 ++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/recipes/conversation/conversation.js b/recipes/conversation/conversation.js index 18e91c31..c2e02195 100755 --- a/recipes/conversation/conversation.js +++ b/recipes/conversation/conversation.js @@ -82,15 +82,35 @@ var textStream ; ************************************************************************ In this step, the audio sample is sent (piped) to "Watson Speech to Text" to transcribe. The service converts the audio to text and saves the returned text in "textStream" +You can also set the language model for your speech input. +The following language models are available + ar-AR_BroadbandModel + en-UK_BroadbandModel + en-UK_NarrowbandModel + en-US_BroadbandModel (the default) + en-US_NarrowbandModel + es-ES_BroadbandModel + es-ES_NarrowbandModel + fr-FR_BroadbandModel + ja-JP_BroadbandModel + ja-JP_NarrowbandModel + pt-BR_BroadbandModel + pt-BR_NarrowbandModel + zh-CN_BroadbandModel + zh-CN_NarrowbandModel */ -textStream = micInputStream.pipe(speech_to_text.createRecognizeStream({ +var recognizeparams = { content_type: 'audio/l16; rate=44100; channels=2', interim_results: true, keywords: [attentionWord], smart_formatting: true, - keywords_threshold: 0.5 -})); + keywords_threshold: 0.5, + model: 'en-US_BroadbandModel' // Specify your language model here +}; + + +textStream = micInputStream.pipe(speech_to_text.createRecognizeStream(recognizeparams)); textStream.setEncoding('utf8'); diff --git a/recipes/speech_to_text/stt.js b/recipes/speech_to_text/stt.js index f49f400f..3f489e93 100644 --- a/recipes/speech_to_text/stt.js +++ b/recipes/speech_to_text/stt.js @@ -64,8 +64,7 @@ console.log("TJBot is listening, you may speak now."); In this step, the audio sample is sent (piped) to "Watson Speech to Text" to transcribe. The service converts the audio to text and saves the returned text in "textStream". You can also set the language model for your speech input. - -The following language models are available + The following language models are available ar-AR_BroadbandModel en-UK_BroadbandModel en-UK_NarrowbandModel @@ -84,7 +83,7 @@ The following language models are available var recognizeparams = { content_type: 'audio/l16; rate=44100; channels=2', model: 'en-US_BroadbandModel' // Specify your language model here -} +}; var textStream = micInputStream.pipe( speech_to_text.createRecognizeStream(recognizeparams) );