Home Manual Reference Source
private class | source

ChoiceRecognitionController

Controller class for the ChoiceRecognition model.

Constructor Summary

Public Constructor
public

constructor(connection: Connection)

Member Summary

Private Members
private

Object to use for making a connection to the REST API and Websocket server.

Method Summary

Public Methods
public

getChoiceRecognition(challengeId: string, recognitionId: string): Promise<ChoiceRecognition>

Get a choice recognition in a choice challenge from the current active Organisation derived from the OAuth2 scope.

public

Get and return all choice recognitions in a specific ChoiceChallenge from the current active Organisation derived from the OAuth2 scope.

public

Start a choice recognition from streaming audio.

Private Methods
private

choiceRecognitionInitAudio(recorder: AudioRecorder, dataavailableCb: Function): *

Initialise the pronunciation analysis audio specs through RPCs.

private

Initialise the choice recognition challenge through RPCs.

Public Constructors

public constructor(connection: Connection) source

Params:

NameTypeAttributeDescription
connection Connection

Object to use for making a connection to the REST API and Websocket server.

Private Members

private _connection: Connection source

Object to use for making a connection to the REST API and Websocket server.

Public Methods

public getChoiceRecognition(challengeId: string, recognitionId: string): Promise<ChoiceRecognition> source

Get a choice recognition in a choice challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a choice challenge identifier.

recognitionId string

Specify a choice recognition identifier.

Return:

Promise<ChoiceRecognition>

Promise containing a ChoiceRecognition.

Throw:

Promise.<Error>

challengeId parameter of type "string" is required.

Promise.<Error>

recognitionId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getChoiceRecognitions(challengeId: string): Promise<ChoiceRecognition[]> source

Get and return all choice recognitions in a specific ChoiceChallenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a choice challenge to list speech recognitions for.

Return:

Promise<ChoiceRecognition[]>

Promise containing an array of ChoiceRecognitions.

Throw:

Promise.<Error>

challengeId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public startStreamingChoiceRecognition(challenge: ChoiceChallenge, recorder: AudioRecorder, trim: boolean): Promise<ChoiceRecognition> source

Start a choice recognition from streaming audio.

Params:

NameTypeAttributeDescription
challenge ChoiceChallenge

The choice challenge to perform.

recorder AudioRecorder

The audio recorder to extract audio from.

trim boolean
  • optional
  • default: true

Whether to trim the start and end of recorded audio.

Emit:

string

'ReadyToReceive' when the call is made to receive audio. The recorder can now send audio.

Throw:

Promise.<Error>

challenge parameter of type "ChoiceChallenge" is required.

Promise.<Error>

challenge.id field of type "string" is required.

Promise.<Error>

If the connection is not open.

Promise.<Error>

If the recorder is already recording.

Promise.<Error>

If a recognition session is already in progress.

Promise.<Error>

If something went wrong during analysis.

Private Methods

private choiceRecognitionInitAudio(recorder: AudioRecorder, dataavailableCb: Function): * source

Initialise the pronunciation analysis audio specs through RPCs.

Params:

NameTypeAttributeDescription
recorder AudioRecorder

AudioRecorder.

dataavailableCb Function

Callback.

Return:

*

private choiceRecognitionInitChallenge(challenge: ChoiceChallenge): * source

Initialise the choice recognition challenge through RPCs.

Params:

NameTypeAttributeDescription
challenge ChoiceChallenge

ChoiceChallenge.

Return:

*