You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: speech-to-text/recognize-file.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ var WritableElementStream = require('./writable-element-stream');
35
35
* @param {String} options.token - Auth Token - see https://github.com/watson-developer-cloud/node-sdk#authorization
36
36
* @param {Blob|File} options.data - the raw audio data as a Blob or File instance
37
37
* @param {Boolean} [options.play=false] - If a file is set, play it locally as it's being uploaded
38
-
* @param {Boolena} [options.format=true] - pipe the text through a {FormatStream} which performs light formatting
38
+
* @param {Boolena} [options.format=true] - pipe the text through a {FormatStream} which performs light formatting. Also controls smart_formatting option unless explicitly set.
39
39
* @param {Boolena} [options.realtime=options.play] - pipe the text through a {TimingStream} which slows the output down to real-time to match the audio playback.
40
40
* @param {String|DOMElement} [options.outputElement] pipe the text to a WriteableElementStream targeting the specified element. Also defaults objectMode to true to enable interim results.
41
41
*
@@ -51,6 +51,13 @@ module.exports = function recognizeFile(options) {
51
51
options.objectMode=true;
52
52
}
53
53
54
+
// default format to true (capitals and periods)
55
+
// default smart_formatting to options.format value (dates, currency, etc.)
Copy file name to clipboardExpand all lines: speech-to-text/recognize-microphone.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ var bitBucket = new Writable({
43
43
*
44
44
* @param {Object} options - Also passed to {RecognizeStream}, and {FormatStream} when applicable
45
45
* @param {String} options.token - Auth Token - see https://github.com/watson-developer-cloud/node-sdk#authorization
46
-
* @param {Boolean} [options.format=true] - pipe the text through a {FormatStream} which performs light formatting
46
+
* @param {Boolean} [options.format=true] - pipe the text through a {FormatStream} which performs light formatting. Also controls smart_formatting option unless explicitly set.
47
47
* @param {Boolean} [options.keepMicrophone=false] - keeps an internal reference to the microphone stream to reuse in subsequent calls (prevents multiple permissions dialogs in firefox)
48
48
* @param {String|DOMElement} [options.outputElement] pipe the text to a WriteableElementStream targeting the specified element. Also defaults objectMode to true to enable interim results.
49
49
*
@@ -59,6 +59,13 @@ module.exports = function recognizeMicrophone(options) {
59
59
options.objectMode=true;
60
60
}
61
61
62
+
// default format to true (capitals and periods)
63
+
// default smart_formatting to options.format value (dates, currency, etc.)
64
+
options.format=(options.format!==false);
65
+
if(typeofoptions.smart_formatting==='undefined'){
66
+
options.smart_formatting=options.format;
67
+
}
68
+
62
69
// we don't want the readable stream to have objectMode on the input even if we're setting it for the output
63
70
varrsOpts=assign({},options);
64
71
rsOpts.readableObjectMode=options.objectMode;
@@ -88,7 +95,7 @@ module.exports = function recognizeMicrophone(options) {
88
95
// set up the output first so that we have a place to emit errors
* @param {Number} [options.inactivity_timeout=30] - how many seconds of silence before automatically closing the stream (even if continuous is true). use -1 for infinity
123
123
* @param {Boolean} [options.readableObjectMode=false] - emit `result` objects instead of string Buffers for the `data` events. Changes several other defaults.
124
124
* @param {Number} [options.X-WDC-PL-OPT-OUT=0] - set to 1 to opt-out of allowing Watson to use this request to improve it's services
125
+
* @param {Boolean} [options.smart_formatting=false] - formats numeric values such as dates, times, currency, etc.
0 commit comments