pepper.framework.component.context module

class pepper.framework.component.context.ContextComponent(backend)[source]

Bases: pepper.framework.abstract.component.AbstractComponent

Exposes Context to Applications and contains logic to determine whether conversation should start/end.

Parameters:backend (AbstractBackend) – Application Backend
CONVERSATION_TIMEOUT = 30
PERSON_AREA_ENTER = 0.25
PERSON_AREA_EXIT = 0.2
PERSON_DIFF_ENTER = 1.5
PERSON_DIFF_EXIT = 1.1
context

Reference to Context

Returns:context – Current Context
Return type:Context
face_vectors

Returns Face Vectors obtained during one-on-one conversation. These may be used to store a known person

Returns:face_vectors – Face Representations as numpy.ndarrays
Return type:Deque[np.ndarray]
on_chat_enter(person)[source]

On Chat Enter Event. Called every time the conversation logic decides a conversation should start.

When called, this does not actually automatically start a conversation, this is up to the user to decide. Conversations can be started anytime by calling ContextComponent.context.start_chat().

Parameters:person (str) – The person (or group of people: config.HUMAN_CROWD), the conversation should start with.
on_chat_exit()[source]

On Chat Exit Event. Called every time the conversation logic decides a conversation should stop.

When called, this does not actually automatically stop a conversation, this is up to the user to decide. Conversations can be stopped anytime by calling ContextComponent.context.stop_chat().

on_chat_turn(utterance)[source]

On Chat Turn Callback, called every time the speaker utters some Utterance

Parameters:utterance (Utterance) – Utterance speaker uttered
say(text, animation=None, block=False)[source]

Say Text (with optional Animation) through Text-to-Speech

This overrides TextToSpeechComponent.say and adds the text to the current chat (if chatting)

Parameters:
  • text (str) – Text to say through Text-to-Speech
  • animation (str or None) – (Naoqi) Animation to play
  • block (bool) – Whether this function should block or immediately return after calling