Skip to content

Commit da6073d

Browse files
committed
basic docs for timing stream
1 parent 5ca93d7 commit da6073d

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,22 @@ Pipe a `RecognizeStream` to a format stream, and the resulting text and `results
8686
* Add a period to the end
8787
* Fix any "cruft" in the transcription
8888
* A few other tweaks for asian languages and such.
89-
90-
#### Methods
9189

92-
* `.promise()`: returns a promise that will resolve to the final text, formatted.
93-
Note that you must either set `continuous: false` or call `.stop()` on the `RecognizeStream` to make the promise resolve in a timely manner.
94-
95-
#### Events
96-
In addition to the standard [Node.js stream events](https://nodejs.org/api/stream.html), the following events are fired:
90+
Inherits `.promise()` and `.stop()` methods and `result` event from the `RecognizeStream`.
9791

98-
* `result`: an individual result object from the results array.
99-
May include final or interim transcription, alternatives, word timing, confidence scores, etc. depending on passed in options.
100-
Note: Listening for `result` will automatically put the stream into flowing mode.
92+
93+
### Class `TimingStream()`
94+
95+
For use with `.recognizeBlob({playFile: true})` - slows the results down to match the audio. Pipe in the `RecognizeStream` (or `FormatStream`) and listen for results as usual.
96+
97+
Inherits `.stop()` method and `result` event from the `RecognizeStream`.
10198

10299

103100
## todo
104101

102+
* Fix bugs around `.stop()
105103
* Solidify API
106104
* (eventually) add text-to-speech support
107-
* add a WordTimingStream (that slows down output to not go fater than word timings)
108105
* add an example that includes alternatives and word confidence scores
109106
* automate dist/ generation (and possibly move it)
110107
* enable eslint
@@ -115,3 +112,4 @@ In addition to the standard [Node.js stream events](https://nodejs.org/api/strea
115112
* update node-sdk to use current version of this lib's RecognizeStream (and also provide the FormatStream + anything else that might be handy)
116113
* improve docs
117114
* look at supporting/migrating to https://streams.spec.whatwg.org/ / https://github.com/whatwg/streams once it's ready
115+
* Add Text to Speech once CORS support is avaliable.

dist/watson-speech.js

Lines changed: 2 additions & 18 deletions
Large diffs are not rendered by default.

speech-to-text/timing-stream.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ TimingStream.prototype.handleResult = function handleResult(result) {
194194
}
195195
};
196196

197-
TimingStream.prototype.promise = require('./promise');
198-
199197
TimingStream.prototype.stop = function(){}; // usually overwritten during the `pipe` event
200198

201199

0 commit comments

Comments
 (0)