ASR
Represents an ASR object provides speech recognition capabilities. Audio stream can be sent to an ASR instance from , or objects. Parameters language or dictionary should be passed to the [VoxEngine.createASR] function.
Add the following line to your scenario code to use the class:
require(Modules.ASR);
Constructors
constructor
Parameters
id:
string
language:
string
dictionary:
string
Methods
addEventListener
addEventListener(event: ASREvents
, callback: Function
): void
Adds a handler for the specified event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
event:
ASREvents
Event class (i.e., [ASREvents.Stopped])
callback:
Function
Handler function. A single parameter is passed - object with event information
Returns
type:
void
dictionary
dictionary(): string[]
Returns the asr's dictionary.
Returns
type:
string[]
id
id(): string
Returns the asr's id.
Returns
type:
string
language
language(): string
Returns the asr's language.
Returns
type:
string
removeEventListener
removeEventListener(event: ASREvents
, callback: Function
): void
Removes a handler for the specified event.
Parameters
event:
ASREvents
Event class (i.e., [ASREvents.Stopped])
callback:
Function
OptionalOptional. Handler function. If not specified, all handler functions are removed
Returns
type:
void
stop
stop(): void
Stops recognition. Triggers the [ASREvents.Stopped] event. Do not call any other ASR functions/handlers after the ASR.stop call.
Returns
type:
void