Class: RecognizeStream

RecognizeStream

new RecognizeStream(options)

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.

Parameters:
Name Type Description
options Object
Source:

Methods

getTransactionId()

Returns a Promise that resolves with Watson Transaction ID from the X-Transaction-ID header

Works in Node.js but not in browsers (the W3C WebSocket API does not expose headers)

Source:
Returns:

Promise

Events

close

Parameters:
Name Type Description
reasonCode Number
description String
Source:

data

Finalized text

Parameters:
Name Type Description
transcript String
Source:

error

Source:

results

Object with interim or final results, including possible alternatives. May have no results at all for empty audio files.

Parameters:
Name Type Description
results Object
Source:

speaker_labels

Speaker labels

Parameters:
Name Type Description
speaker_labels Object
Source: