eu.semaine.components.dialogue.interpreters
Class TurnTakingInterpreter

java.lang.Object
  extended by java.lang.Thread
      extended by eu.semaine.components.Component
          extended by eu.semaine.components.dialogue.interpreters.TurnTakingInterpreter
All Implemented Interfaces:
SEMAINEMessageAvailableListener, java.lang.Runnable

public class TurnTakingInterpreter
extends Component

The TurnTakingInterpreter looks at the behaviour of the user and has to decide when is a good moment to start speaking. When this moment is decided the decision is send forward. Input UserStateReceiver('semaine.data.state.user') --> user speaking state and detected emotions AgentStateReceiver('semaine.data.state.agent') --> current character Output AgentStateSender('semaine.data.state.agent') --> take/release turn messages

Author:
MaatM

Nested Class Summary
 
Nested classes/interfaces inherited from class eu.semaine.components.Component
Component.State
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int OBADIAH
           
static int POPPY
           
static int PRUDENCE
           
static int SPIKE
           
 
Fields inherited from class eu.semaine.components.Component
inputWaiting, isInput, isOutput, log, meta, receivers, senders, state, waitingTime
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TurnTakingInterpreter()
          Constructor of TurnTakingInterpreter Initializes the senders and receivers, and sets the waitingtime for Act()
 
Method Summary
 void act()
          Called every 50ms, reevaluates the current situation and tries to determine if the agent should start talking.
 void addDetectedEmotions(StateInfo userInfo)
          Reads the received Message and tries to filter out the detected Emotion Events.
 void determineAgentTurn()
          Determines if the agent should start speaking or not.
 int getSpeakingIntentionValue()
          Calculates the speaking intention value for the current moment.
 void processBackchannel(StateInfo agentInfo)
           
 void processHeadMovements(StateInfo stateInfo)
           
 void react(SEMAINEMessage m)
          Reads the message, filters out the detected user speaking state and the detected emotions, and tries to determine if the agent should start speaking.
 void sendAgentTurnState()
           
 void setAgentSpeakingState(StateInfo dialogInfo)
          Reads the received Message and tries to filter out the detected user speaking state.
 void setCharacter(StateInfo agentInfo)
          Reads the received Message and tries to filter out a change of character
 void setUserSpeakingState(StateInfo userInfo)
          Reads the received Message and tries to filter out the detected user speaking state.
 void updateCharacter(StateInfo stateInfo)
           
 
Methods inherited from class eu.semaine.components.Component
customStartIO, exitRequested, getMeta, hasSystemJustBecomeReady, messageAvailableFrom, requestExit, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POPPY

public static final int POPPY
See Also:
Constant Field Values

PRUDENCE

public static final int PRUDENCE
See Also:
Constant Field Values

SPIKE

public static final int SPIKE
See Also:
Constant Field Values

OBADIAH

public static final int OBADIAH
See Also:
Constant Field Values
Constructor Detail

TurnTakingInterpreter

public TurnTakingInterpreter()
                      throws JMSException
Constructor of TurnTakingInterpreter Initializes the senders and receivers, and sets the waitingtime for Act()

Throws:
JMSException
Method Detail

react

public void react(SEMAINEMessage m)
           throws JMSException
Reads the message, filters out the detected user speaking state and the detected emotions, and tries to determine if the agent should start speaking.

Overrides:
react in class Component
Throws:
JMSException - if communication with the JMS server goes wrong.

processHeadMovements

public void processHeadMovements(StateInfo stateInfo)
                          throws JMSException
Throws:
JMSException

updateCharacter

public void updateCharacter(StateInfo stateInfo)
                     throws JMSException
Throws:
JMSException

act

public void act()
         throws JMSException
Called every 50ms, reevaluates the current situation and tries to determine if the agent should start talking.

Overrides:
act in class Component
Throws:
JMSException - if communication with the JMS server goes wrong.

setAgentSpeakingState

public void setAgentSpeakingState(StateInfo dialogInfo)
Reads the received Message and tries to filter out the detected user speaking state.

Parameters:
m - - the received message

setUserSpeakingState

public void setUserSpeakingState(StateInfo userInfo)
Reads the received Message and tries to filter out the detected user speaking state.

Parameters:
m - - the received message

setCharacter

public void setCharacter(StateInfo agentInfo)
Reads the received Message and tries to filter out a change of character

Parameters:
am - - the received message

processBackchannel

public void processBackchannel(StateInfo agentInfo)

addDetectedEmotions

public void addDetectedEmotions(StateInfo userInfo)
Reads the received Message and tries to filter out the detected Emotion Events.

Parameters:
m - - the received message

determineAgentTurn

public void determineAgentTurn()
                        throws JMSException
Determines if the agent should start speaking or not. It bases this decision on the speaking_intention, a value for how much the agent wants the turn.

Throws:
JMSException

getSpeakingIntentionValue

public int getSpeakingIntentionValue()
Calculates the speaking intention value for the current moment. This is a value for how much the agent wants the turn. This is calculated based on detected emotion events, the user speaking state, the duration of this state, and the agent speaking state plus its duration. The higher the value, the higher the intention to speak. Currently, the speaking intention value is the sum of these values: user_silence_time_value: a value between 0 and 100 which is higher when the user is silent for a longer time (max is reached after 0.8 seconds). emotion_value: a value based on the number of detected emotion events. More detected events lead to a higher value. agent_silence_time_value: a value that's higher when the agent is silent (user is speaking) for a longer period (max is reached after 30 seconds). agent_end_wait_value: a value that starts at -100 when the agent finishes its utterance, and in the next 2 seconds slowly rises (linear) to 0; user_not_responding_value: a value that rises from 0 to 100 when the user does not start talking after an agent-turn. It starts after 2 seconds, and then rises to 100 in 4 seconds unless the user starts speaking.

Returns:

sendAgentTurnState

public void sendAgentTurnState()
                        throws JMSException
Throws:
JMSException