Module: managers/speech-manager

This module manages speech

Source:

Requires

Methods


init()

Initializes class

Source:

initSpeech()

Init speech

Source:
Fires:
  • event:assignListeners();

assignListeners()

Assigns listeners to events used in this class.

Source:
Listens to Events:
  • event:EVENT_ADMIN_GOT_MANIFEST
  • event:EVENT_TEMPLATE_LOADED
  • event:EVENT_TIMER_EXPIRED
  • event:EVENT_HISTORY
  • avatar.eventTypes.event:"CC"
  • avatar.eventTypes.event:"END_CC"
  • avatar.eventTypes.event:"PHRASE_RECOGNIZED"

toggleSpeech(state)

Enables or Disables speech recognition

Parameters:
Name Type Description
state 'enable' | 'disable'

toggle to state

Source:

doWalkAway()

Sets the WalkAway state

Source:
Fires:
  • event:EVENT_IN_WALKAWAY

resetSpeech( [isFromEndCc])

Resets the closed caption and speech panels

Parameters:
Name Type Argument Default Description
isFromEndCc Boolean <optional>
false

If true that this call is coming from an endCC event.

Source:

showCC(data)

Shows the closed caption copy of the ID found in content/json/langCopy.json

Parameters:
Name Type Description
data String

data of the closed caption

Source:

isValidIntent(intentStr)

Validates intent against manifest.IntentMetaData

Parameters:
Name Type Description
intentStr String

Intent to validate

Source:
Returns:

Returns the IntentMetaData object for that intent

Type
Object

triggerActionEvent(phraseObj)

Triggers an action event from processed phrase metadata results

Parameters:
Name Type Description
phraseObj Object

Phrase object from speech to text.

Source:
Fires:
  • event:Event associated with action

formatIntentName(intentStr)

Reformats string for consistant valid intent name used for dynamic speech.

Parameters:
Name Type Description
intentStr String

String to be formated

Source:
Returns:

Formatted string

Type
String

formatQnaIntent(qnaID)

Reformats qna ID to be used as intent.

Parameters:
Name Type Description
qnaID String

String to be formated

Source:
Returns:

Formatted string

Type
String

processSpeechContext(phraseObj)

Process the context of the speech to text object. Context can be comment, navigation, location. Options include comment_intent, navigation_back, navigation_home, navigation_intent, location_locationID

Parameters:
Name Type Description
phraseObj Object

Phrase object from speech to text.

Source:
Fires:
  • event:triggerActionEvent()

processSpeechPhrase(phraseObj)

Process the phrase of the speech to text object to process the context and display the speech to the UX

Parameters:
Name Type Description
phraseObj Object

Phrase object from speech to text.

Source:
Fires:
  • event:processSpeechContext()

onQaUpdateCheck()

Knowedge Base modified check. Refresh browser if true.

Source:

onModelReady()

Initializes class

Source:

onToggleMic(forceState)

Toggle the mic state

Parameters:
Name Type Description
forceState Boolean

(Optional) forces mic state

Source:

onProcessStatusMessage(data)

Receive and process Prsonas event status message

Parameters:
Name Type Description
data Object

Message object

Source:

onCcEvent(data)

Receives closed caption event

Parameters:
Name Type Description
data Object

Message object

Source:
Fires:
  • event:showCC()

onEndCcEvent(data)

Receives end closed caption event

Parameters:
Name Type Description
data Object

Message object

Source:

onIndicatorUpdate(data)

Receive and process UX updates on status indicator states

Parameters:
Name Type Description
data Object

Message object

Source:

onSpeechPhraseRecognized(data)

Receive and parse phrase from speech to text.

Parameters:
Name Type Description
data Object

Speech data

Source:
Fires:
  • event:processSpeechPhrase()

onPageLoad(eventId, data)

Called when a page is loaded

Parameters:
Name Type Description
eventId String

Event ID

data Object

Event data

Source: