UNPKG

watson-speech

Version:

IBM Watson Speech to Text and Text to Speech SDK for web browsers.

1,220 lines (330 loc) 16 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: RecognizeStream</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: RecognizeStream</h1> <section> <header> <h2>RecognizeStream</h2> </header> <article> <div class="container-overview"> <h4 class="name" id="RecognizeStream"><span class="type-signature"></span>new RecognizeStream<span class="signature">(options)</span><span class="type-signature"></span></h4> <div class="description"> pipe()-able Node.js Readable/Writeable stream - accepts binary audio and emits text in it's `data` events. Also emits `results` events with interim results and other data. Cannot be instantiated directly, instead reated by calling #createRecognizeStream() Uses WebSockets under the hood. For audio with no recognizable speech, no `data` events are emitted. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>model</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 'en-US_BroadbandModel' </td> <td class="description last">voice model to use. Microphone streaming only supports broadband models.</td> </tr> <tr> <td class="name"><code>url</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 'wss://stream.watsonplatform.net/speech-to-text/api' </td> <td class="description last">base URL for service</td> </tr> <tr> <td class="name"><code>content-type</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 'audio/wav' </td> <td class="description last">content type of audio; should be automatically determined in most cases</td> </tr> <tr> <td class="name"><code>interim_results</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">Send back non-final previews of each "sentence" as it is being processed</td> </tr> <tr> <td class="name"><code>continuous</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">set to false to automatically stop the transcription after the first "sentence"</td> </tr> <tr> <td class="name"><code>word_confidence</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">include confidence scores with results</td> </tr> <tr> <td class="name"><code>timestamps</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last">include timestamps with results</td> </tr> <tr> <td class="name"><code>max_alternatives</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 3 </td> <td class="description last">maximum number of alternative transcriptions to include</td> </tr> <tr> <td class="name"><code>inactivity_timeout</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 30 </td> <td class="description last">how many seconds of silence before automatically closing the stream (even if continuous is true). use -1 for infinity //todo: investigate other options at http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/speech-to-text/recognizeSessionless</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line55">line 55</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Events</h3> <h4 class="name" id="event:connection-close">connection-close</h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>reasonCode</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>description</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line136">line 136</a> </li></ul></dd> </dl> <h4 class="name" id="event:data">data</h4> <div class="description"> Finalized text </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>transcript</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line202">line 202</a> </li></ul></dd> </dl> <h4 class="name" id="event:error">error</h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line144">line 144</a> </li></ul></dd> </dl> <h4 class="name" id="event:results">results</h4> <div class="description"> Object with interim or final results, including possible alternatives. May have no results at all for empty audio files. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>results</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line194">line 194</a> </li></ul></dd> </dl> <h4 class="name" id="event:results">results</h4> <div class="description"> Object with interim or final results, including possible alternatives. May have no results at all for empty audio files. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>results</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>- use the 'result' event (singular) instead</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="recognize-stream.js.html">recognize-stream.js</a>, <a href="recognize-stream.js.html#line184">line 184</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FormatStream.html">FormatStream</a></li><li><a href="MediaElementAudioStream.html">MediaElementAudioStream</a></li><li><a href="RecognizeStream.html">RecognizeStream</a></li><li><a href="TimingStream.html">TimingStream</a></li><li><a href="WebAudioL16Stream.html">WebAudioL16Stream</a></li></ul><h3>Events</h3><ul><li><a href="RecognizeStream.html#event:connection-close">connection-close</a></li><li><a href="RecognizeStream.html#event:data">data</a></li><li><a href="RecognizeStream.html#event:error">error</a></li><li><a href="RecognizeStream.html#event:results">results</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Feb 08 2016 19:56:04 GMT+0000 (UTC) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>