Home Manual Reference Source
private class | source

PronunciationAnalysisController

Controller class for the PronunciationAnalysis model.

Static Method Summary

Static Private Methods
private static

_wordsToModels(inWords: object[]): Word[]

Create a its.Word domain model from JSON data.

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.

private

Method Summary

Public Methods
public

Get and return all pronunciation analyses in a specific pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Get a pronunciation analysis in a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

public

Start a pronunciation analysis from streaming audio.

Private Methods
private

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

Initialise the pronunciation analysis audio specs through RPCs.

private

Initialise the pronunciation analysis challenge through RPCs.

Static Private Methods

private static _wordsToModels(inWords: object[]): Word[] source

Create a its.Word domain model from JSON data.

Params:

NameTypeAttributeDescription
inWords object[]

The words array from the PronunciationAnalysis API.

Return:

Word[]

An array of Word domain models.

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.

private _referenceAlignment: * source

Public Methods

public getPronunciationAnalyses(challengeId: string, detailed: boolean): Promise<PronunciationAnalysis[]> source

Get and return all pronunciation analyses in a specific pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a pronunciation challenge identifier to list speech recordings for.

detailed boolean
  • optional
  • default: false

Returns extra analysis metadata when true.

Return:

Promise<PronunciationAnalysis[]>

Promise containing an array PronunciationAnalyses.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

If no result could not be found.

public getPronunciationAnalysis(challengeId: string, analysisId: string): Promise<PronunciationAnalysis> source

Get a pronunciation analysis in a pronunciation challenge from the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
challengeId string

Specify a pronunciation challenge identifier.

analysisId string

Specify a pronunciation analysis identifier.

Return:

Promise<PronunciationAnalysis>

Promise containing a PronunciationAnalysis.

Throw:

Promise.<Error>

PronunciationChallenge#id field is required.

Promise.<Error>

PronunciationAnalysis#id field is required.

Promise.<Error>

If no result could not be found.

public startStreamingPronunciationAnalysis(challenge: PronunciationChallenge, recorder: AudioRecorder, trim: boolean): Promise<PronunciationAnalysis> source

Start a pronunciation analysis from streaming audio.

Params:

NameTypeAttributeDescription
challenge PronunciationChallenge

The pronunciation challenge to perform.

recorder AudioRecorder

The audio recorder to extract audio from.

trim boolean
  • nullable: true

Whether to trim the start and end of recorded audio (default: true).

Emit:

string

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

Object

When the sent audio has finished alignment. Aligning audio is the process of mapping the audio to spoken words and determining when what is said. An object is sent containing a property 'progress', which is the sent audio alignment, and a property 'referenceAlignment' which is the alignment of the reference audio.

Throw:

Promise.<Error>

challenge parameter of type "PronunciationChallenge" 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 session is already in progress.

Promise.<Error>

If something went wrong during analysis.

Private Methods

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

Initialise the pronunciation analysis audio specs through RPCs.

Params:

NameTypeAttributeDescription
recorder AudioRecorder

AudioRecorder.

dataavailableCb Function

Callback.

Return:

*

private pronunciationAnalysisInitChallenge(challenge: PronunciationChallenge): * source

Initialise the pronunciation analysis challenge through RPCs.

Params:

NameTypeAttributeDescription
challenge PronunciationChallenge

Challenge.

Return:

*