pyzenbo.modules.dialog_system module

class pyzenbo.modules.dialog_system.DialogSystem(inter_comm)

Bases: object

clear_app_context(domain, sync=True, timeout=None)

Clear specific domain UUID in current dialog system stack.

Parameters
  • domain – domain UUID

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

clear_background_context(domain, sync=True, timeout=None)

Clear background context.

Parameters
  • domain – domain UUID

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

dynamic_edit_instance(domain, action, entity, instances, sync=True, timeout=None)

Add/Delete/Update user defined instances of an specific Entity.

Parameters
  • domain – domain UUID

  • action – types of action

  • entity – the existed entity added on the Concept page of DS Editor

  • instances – the instances to be modified

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

jump_to_plan(domain, plan, cross_intent=None, sync=True, timeout=None)

Let dialog state switch to specific plan, and set output context of this plan on top of the context stack.

Parameters
  • domain – domain UUID

  • plan – plan ID to be switched to

  • cross_intent – set True to enable cross intent

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

query_expression_status(sync=True, timeout=None)

Query expression status, return result in onResult callback, result will have an JSON string, key is “RESULT”. JSON object have two element, FaceID and FaceExit. FaceID is current face value, and FaceExit is an boolean True is currently have display expression.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

register_listen_callback(domain, listen, sync=True, timeout=None)

Register the listen callback functions for Dialog System.

Parameters
  • domain – domain UUID

  • listen – listen callback function

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

set_background_context(domain, plan, sync=True, timeout=None)

Set background context.

Parameters
  • domain – domain UUID

  • plan – plan ID

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

set_expression(facial, sentence=None, config=None, sync=True, timeout=None)

Make robot expression and speak.

Parameters
  • facial – robot face expression ID: HIDEFACE, INTERESTED, DOUBTING, PROUD, DEFAULT, HAPPY, EXPECTING, SHOCKED, QUESTIONING, IMPATIENT, CONFIDENT, ACTIVE, PLEASED, HELPLESS, SERIOUS, WORRIED, PRETENDING, LAZY, AWARE_RIGHT, TIRED, SHY, INNOCENT, SINGING, AWARE_LEFT, DEFAULT_STILL

  • sentence – sentence of text to speech

  • config – configuration for expression engine

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code serial number of the command

set_voice_trigger(enable, sync=True, timeout=None)

Set dialog system voice trigger.

Parameters
  • enable – flag to enable/disable dialog system voice trigger

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

speak(sentence, config=None, sync=True, timeout=None)

Start speaking.

Parameters
  • sentence – sentence of text to speech

  • config – configuration for speak engine

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code serial number of the command

speak_and_listen(sentence, config=None, sync=True, timeout=None)

Start speaking and listening. If sentence is an empty string (“”), Zenbo will listen directly.

Parameters
  • sentence – sentence sentence of text to speech

  • config – configuration for speak engine

  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

stop_speak(sync=True, timeout=None)

Stop speaking.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code serial number of the command

stop_speak_and_listen(sync=True, timeout=None)

Stop speak and listen.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

unregister_listen_callback(sync=True, timeout=None)

Unregister listen callback.

Parameters
  • sync – True if this command is blocking

  • timeout – maximum blocking time in second, None means infinity

Returns

serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code

wait_for_listen(sentence, config=None, timeout=10)

Wait for speak and listen execute completed and return SLU result.

Parameters
  • sentence – sentence sentence of text to speech

  • config – configuration for speak engine

  • timeout – maximum blocking time in second, None means infinity

Returns

SLU result, if timeout will return None

class pyzenbo.modules.dialog_system.RobotFace

Bases: object

ACTIVE = 'ACTIVE'
AWARE_LEFT = 'AWARE_LEFT'
AWARE_RIGHT = 'AWARE_RIGHT'
CONFIDENT = 'CONFIDENT'
DEFAULT = 'DEFAULT'
DEFAULT_STILL = 'DEFAULT_STILL'
DOUBTING = 'DOUBTING'
EXPECTING = 'EXPECTING'
HAPPY = 'HAPPY'
HELPLESS = 'HELPLESS'
HIDEFACE = 'HIDEFACE'
IMPATIENT = 'IMPATIENT'
INNOCENT = 'INNOCENT'
INTERESTED = 'INTERESTED'
LAZY = 'LAZY'
PLEASED = 'PLEASED'
PRETENDING = 'PRETENDING'
PROUD = 'PROUD'
QUESTIONING = 'QUESTIONING'
SERIOUS = 'SERIOUS'
SHOCKED = 'SHOCKED'
SHY = 'SHY'
SINGING = 'SINGING'
TIRED = 'TIRED'
WORRIED = 'WORRIED'