Class: SpeechToText

SpeechToText

watson.speech_to_text({version: 'v1', ...});

Speech Recognition API Wrapper
Parameters:
Name Type Description
options
Source:

Methods

createRecognizeStream(params) → {RecognizeStream}

Replaces recognizeLive & friends with a single 2-way stream over websockets
Parameters:
Name Type Description
params
Source:
Returns:
Type
RecognizeStream

createSession(string)

Create a session Set-cookie header is returned with a cookie that must be used for each request using this session. The session expires after 15 minutes of inactivity.
Parameters:
Name Type Description
string model The model to use during the session
Source:

deleteSession()

Deletes the specified session.
Parameters:
Name Type Attributes Description
params.session_id String <optional>
Session id.
Source:

getModel()

Get information about a model based on the given model_id
Parameters:
Name Type Attributes Description
params.model_id String <optional>
The desired model
Source:

getModels()

List of models available.
Source:

getRecognizeStatus()

Get the state of the engine to check if recognize is available. This is the way to check if the session is ready to accept a new recognition task. The returned state has to be 'initialized' to be able to do recognize POST.
Parameters:
Name Type Attributes Description
params.session_id String <optional>
Session used in the recognition.
Deprecated:
  • use createRecognizeStream instead
Source:

observeResult()

Result observer for upcoming or ongoing recognition task in the session. This request has to be started before POST on recognize finishes, otherwise it waits for the next recognition.
Parameters:
Name Type Attributes Description
params.session_id String <optional>
Session used in the recognition.
params.interim_results boolean <optional>
If true, interim results will be returned. Default: false.
Deprecated:
  • use createRecognizeStream instead
Source:

recognize(audioopt, content_typeopt)

Speech recognition for given audio using default model.
Parameters:
Name Type Attributes Description
audio Audio <optional>
Audio to be recognized.
content_type String <optional>
Content-type
Source:

recognizeLive(content_typeopt, session_idopt)

Creates a HTTP/HTTPS request to /recognize and keep the connection open. Sets 'Transfer-Encoding': 'chunked' and prepare the connection to send chunk data
Parameters:
Name Type Attributes Description
content_type String <optional>
The Content-type e.g. audio/l16; rate=48000
session_id String <optional>
The session id
Deprecated:
  • use createRecognizeStream instead
Source: