import ChoiceRecognitionController from 'itslanguage/administrative-sdk/choice-recognition/choice-recognition-controller.js'
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 |
getChoiceRecognitions(challengeId: string): Promise<ChoiceRecognition[]> Get and return all choice recognitions in a specific ChoiceChallenge from the current active Organisation derived from the OAuth2 scope. |
|
public |
startStreamingChoiceRecognition(challenge: ChoiceChallenge, recorder: AudioRecorder, trim: boolean): Promise<ChoiceRecognition> Start a choice recognition from streaming audio. |
Private Methods | ||
private |
choiceRecognitionInitAudio(recorder: AudioRecorder, dataavailableCb: Function): * Initialise the pronunciation analysis audio specs through RPCs. |
|
private |
choiceRecognitionInitChallenge(challenge: ChoiceChallenge): * Initialise the choice recognition challenge through RPCs. |
Public Constructors
public constructor(connection: Connection) source
Params:
Name | Type | Attribute | Description |
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.
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:
Name | Type | Attribute | Description |
challengeId | string | Specify a choice challenge to list speech recognitions for. |
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:
Name | Type | Attribute | Description |
challenge | ChoiceChallenge | The choice challenge to perform. |
|
recorder | AudioRecorder | The audio recorder to extract audio from. |
|
trim | boolean |
|
Whether to trim the start and end of recorded audio. |
Return:
Promise<ChoiceRecognition> | A https://github.com/cujojs/when Promise containing a ChoiceRecognition. |
Emit:
'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:
Name | Type | Attribute | Description |
recorder | AudioRecorder | AudioRecorder. |
|
dataavailableCb | Function | Callback. |
Return:
* |
private choiceRecognitionInitChallenge(challenge: ChoiceChallenge): * source
Initialise the choice recognition challenge through RPCs.
Params:
Name | Type | Attribute | Description |
challenge | ChoiceChallenge | ChoiceChallenge. |
Return:
* |