Skip to content

Appreciation Generator

Brice Donval edited this page Jan 13, 2020 · 9 revisions

Table of Contents

How to use the Appreciation Generator

Introduction

The Appreciation Generator is able to trigger an exchange of appreciations (opinions) between a user and an ECA. The ECA asks for user's opinion on a specific topic, and once the user has responded, the ECA expresses its own opinion on the topic in taking into account user's response (by aligning with the user).

An exchange of appreciations is composed of 4 turns. It has the following form:

  • 1-Agent: "This contemporary artwork was on show at the Château de Versailles. How do you like it?" The ECA asks for user's opinion.
  • 2-User: "Er... I like it." The user answers to the ECA.
  • 3-Agent: "Really, you think that the 'Balloon Dog' is nice?" The ECA reacts to user's opinion (appreciation).
  • 4-User: "Absolutely. The contrast with the castle is very funny." The User answers to the ECA.
This exchange is modelled in a DISCO scenario as an Appreciation Task. This task is trigerred under certain conditions: when user's engagement is computed as low, when the current topic is known, and when an appreciation task has not been already launched for this topic.

Including the Appreciation Generator Module with the Greta Modular GUI

You need 4 modules in the Greta Modular GUI in addition to those which are basically required to run an agent. You can A) open a pre-defined configuration file or B) make your own configuration file.

A) Open the pre-defined configuration file

  • Copy-paste the file <GRETA_DIR>/bin/Projects/A11/ModularConfigs/AppreciationGeneratorConfiguration.xml in the directory <GRETA_DIR>/bin/. Do not commit this file on the SVN repository.
  • Click on Fichier -> Ouvrir, and select the file <GRETA_DIR>/bin/AppreciationGeneratorConfiguration.xml

B) Make your own configuration file

First, open your default configuration file (Fichier -> Ouvrir). Then, click on Ajouter, and select consecutively the 4 modules above:

  • Planners -> Appreciation Generator -> Appreciation Generator
  • Disco -> Disco GUI
  • Disco -> Disco Planner
  • Planners -> Listener Intent Planner
You should see all these modules in the Greta GUI. Now, you have to connect them. To make a link from a module A to another module B, left click on A, hold on the mouse, go on the module B, and release the mouse.

Make all the following links:

  • from DiscoGUI to DiscoPlanner
  • from DiscoPlanner to BehaviorPlanner
  • from AppreciationGenerator to ListenerIntentPlanner
  • from DiscoPlanner to AppreciationGenerator
  • from BehaviorRealizer to AppreciationGenerator
Now, save your configuration file so as you don't need to do these steps again (Fichier -> Enregistrer sous).

Your Modular GUI should now look like this:

Options of the Appreciation Generator Module

When you click on the Appreciation Generator in the Modular GUI, you can see several options:

  • Computation method for user's engagement: the Appreciation Generator computes user's engagement level (low, high) with the length of user's speaking turns. You can choose between two methods for the computation of user's engagement level: either a statistical method, or a threshold-based method. More details on these methods can be found in Campano et al., 2015.
  • Policy for the generation of agent's sentences: the Appreciation Generator is able to generate appreciation sentences about topics. You can choose between appreciation sentences with other-repetition, appreciation sentences without other-repetitions, or no appreciation sentence at all. In the last case, a default sentence will be played. You can specify the default sentence in the DISCO scenario.
  • Show user's engagement statistics: when this box is checked, it displays a window giving information in real-time about the length of user's speaking turns, and the engagement level which is computed.
  • Enable the detection of user's appreciations (WOZ): this option displays a window allowing an expert for detecting appreciations in user's speech (Wizard-Of-Oz). The expert can click on two buttons: one when a negative appreciation is detected, and one when a positive appreciation is detected. This input is used by the Appreciation Generator Module to control agent's behaviours when it is in listener mode.
  • Agent's preferences -> Choose File...: this button allows you to choose the file from which agent's preferences must be read. You can find an example file at the location <GRETA_DIR>/bin/Projects/A11/ParameterFiles/agentPreferencesForObjects.xml.
  • Objects description -> Choose File...: this button allows you to choose the file from which objects description must be read. You can find an example file at the location <GRETA_DIR>/bin/Projects/A11/ParameterFiles/objectsAndCharactersDescription.xml
  • Save logs in directory: this button allows to save the logs of user's engagement statistics in the chosen directory. It should be used at the end of the interaction. It saves the chart of user's statistics, and a csv file recording the length of each user's turn.

Using a DISCO scenario calling the Appreciation Generator

An example of a DISCO scenario calling the Appreciation Generator module can be found in the directory <GRETA_DIR>/bin/Projects/A11/DiscoScenarios/D4G/DemoAppreciationGenerator. To launch this scenario with Greta, you should first add the required modules as explained above in the Section "Including the Appreciation Generator Module with the Greta Modular GUI". Make sure that you have added the components required for the speech synthesis and the animation of the agent.

Then, proceed with the following steps:

  • configure the Greta.ini file in the <GRETA_DIR>/bin/ directory such as DISCO_FML_PATH = ./
  • run Modular, and click on the DiscoPlanner Module in the Greta GUI. You should now see the DiscoPlanner window. It is inserted at the bottom of the GUI Modular window, or displayed as a separate window.
  • choose the DISCO scenario to launch with Ouvrir. Select <GRETA_DIR>/bin/Projects/A11/DiscoScenarios/D4G/DemoAppreciationGenerator/DemoAppreciationGenerator.xml
  • click on Envoyer to send the scenario files to the DISCO dialogue Manager
  • click on the DiscoGUI Module. You can see the DISCO GUI window that will allow you to choose an answer (user's answer) while interacting with the ECA
  • click on "Commencer l'interaction". Now, the agent starts the dialogue. You can select the desired answer among the ones which are proposed in the DISCO GUI

Configure the database

Two types of database files are needed for the Appreciation Generator Module:

  • object description file: an XML file containing the description of the different objects discussed in the dialogue scenario, on which an appreciation task could be triggered. This file should be formatted as the file you can find in <GRETA_DIR>/bin/Projects/A11/ParameterFiles/objectsAndCharactersDescription.xml.
  • agent's preferences file: an XML file containing agent's preferences for objects. This file should be formatted as the file you can find in <GRETA_DIR>/bin/Projects/A11/ParameterFiles/agentPreferencesForObjects.xml. An object referenced in the agent's preference file should be included in the object description file.

Writing a DISCO scenario that uses the Appreciation Generator

The Appreciation Generator is tightly coupled with the DISCO Dialogue Manager. When you write a DISCO scenario file (.d4g.xml) that you want to use with the Appreciation Generator Module, you have to write specific information in that file. In order to help you to write your own scenario, open these two example files in a text editor:

  • <GRETA_DIR>/bin/Common/Data/DiscoScenarios/A11Project/D4G/DemoAppreciationGenerator/DemoAppreciationGenerator.d4g.xml
  • <GRETA_DIR>/bin/Common/Data/DiscoScenarios/A11Project/D4G/DemoAppreciationGenerator/DemoAppreciationGenerator.properties

Step 1: write the Appreciation Task.

Copy/paste the following code in your dialogue scenario:

<!-- MODIFY WITH CAUTION.
Appreciation task. -->

<agent id="AppreciationTask" text="{inputPath}{currentAppreciationQuestion}" eval ="currentTarget = discoPlanner.sendCommand_String('getCurrentTopic')" >

	<user text="aime">
		<agent text="{discoPlanner.sendCommandWithString_String('generateAppreciation',
					'aime', inputPath + currentDefaultSentence,
					'POSITIVE', currentTarget, 'aimer', 'VERB')}"/>
	</user>
	<user text="aime pas">
		<agent text="{discoPlanner.sendCommandWithString_String('generateAppreciation',
					'aime pas', inputPath + currentDefaultSentence,
					'NEGATIVE', currentTarget, 'aimer', 'VERB')}"/>
	</user>
	<user text="ne sais pas">
		<agent text="{discoPlanner.sendCommandWithString_String('generateAppreciation',
					currentTarget, inputPath + currentDefaultSentence)}"/>
	</user>

</agent>

This task is composed of 4 speaking turns. The 4th speaking turn is a user turn automatically added by DISCO, so you don't need to write it. The 3rd speaking turn corresponds to an agent's speaking turn, and it is generated by the Appreciation Generator Module. It calls the method generateAppreciation in the Appreciation Generator Module, that takes several parameters in argument and returns agent's sentence (a FML file path).

You can modify this task in order to change user's possible answers. In this case, be sure to:

  • pass the correct parameters to the generateAppreciation method (see Javadoc for details)
  • add the appreciation words in the lexicon of appreciation words appreciationWordsLexicon.xml, located in the source code of the Appreciation Generator Module (<GRETA_DIR>/auxiliary/AppreciationGenerator/src/greta/auxiliary/apprgenerator/database/appreciationWordsLexicon.xml).

Step 2: write the tasks corresponding to the decision process of the Appreciation Generator Module.

Copy/paste the following code in your dialogue scenario::

<!-- DO NOT MODIFY.
Tasks required with DISCO to test whether an appreciation task should be triggered. If so, call the appreciation task. -->

<t:task id="AppreciationProcess">
	<t:subtasks id="subAppreciationProcess">
		<t:step name="appreciationDecision" task="AppreciationDecision"/>
		<t:step name="appreciationTrigger" task="AppreciationTrigger"/>
	</t:subtasks>
</t:task>

<t:task id="AppreciationDecision">

	<t:script>
		appreciationTrigger = discoPlanner.sendCommand_Boolean('getAppreciationDecision', false);
	</t:script>

</t:task>

<t:task id="AppreciationTrigger" >
	<t:subtasks id="subAppreciationTrigger1" >
		<t:step name="appreciationTask" task="AppreciationTask"/>
		<t:applicable> appreciationTrigger == true </t:applicable>
	</t:subtasks>
	<t:subtasks id="subAppreciationTrigger2" >
		<t:step name="noAppreciation" task="NoAppreciation"/>
		<t:applicable> appreciationTrigger == false </t:applicable>
	</t:subtasks>
</t:task>

<t:task id="NoAppreciation">
	<t:script> appreciationTrigger = appreciationTrigger; </t:script>
</t:task>

These tasks are required to decide whether an appreciation task should be triggered or not given the current values of model parameters. Do not modify these tasks.

Step 3: write the initialization script.

The initialization script includes the declaration and the initialization of the variables used in the DISCO scenario file (.d4g.xml).

Copy/paste the following lines in your scenario:

<!-- Initialization script. -->
<t:script init="true">

	var discoPlanner = Packages.greta.auxiliary.disco.DiscoPlanner
	<!-- Path where the FML files for this scenario are stored. -->
	var inputPath = "/Common/Data/DiscoScenarios/A11Project/FML/DemoAppreciationGenerator/"
	<!-- Appreciation target. -->
	var currentTarget = "";
	<!-- Variable which decides whether an appreciation task will be triggered or not. -->
	var appreciationTrigger = true;
	<!-- Default sentence that replaces an agent's appreciation (3rd turn of an appreciation task). -->
	var currentDefaultSentence = "";
	<!-- Question that asks user's appreciation (1st turn of an appreciation task). -->
	var currentAppreciationQuestion ="";

</t:script>

Update the value of the variable inputPath so as it is set to the directory where you store the FML files for your scenario.

Step 4: initialization tasks for the Appreciation Generator Module.

Before the Appreciation Module could trigger an appreciation task, it needs some information related to this task. You need to provide:

  • the default sentence (in FML format) that will be said by the ECA in the 3rd turn of a an appreciation task. This sentence is used only if the model is used in the "no appreciation" mode (see the different options above), or if the agent has no preference for the target.
  • the appreciation question (in FML format) that will be said by the ECA in the 1st turn of a an appreciation task (ex: Do you like this statue ?).
  • the name of the dialogue topic. The current topic is used as a target for the appreciation task. The topic name must be included in the database scenario file containing all scenario objects. You have to call a method belonging to the Appreciation Generator Module to set the current topic (see example below).
The file DemoAppreciationGenerator.d4g.xml provides different examples on how to write an initialization task. An initialization task should look like this:
<t:task id="InitTopicObjetSoldat">

	<t:script>
		currentDefaultSentence = "soldat_sculptureBronze.xml";
		currentAppreciationQuestion = "soldat_questionAppreciation.xml";
		discoPlanner.sendCommandWithString_String('setCurrentTopic', "le style baroque");
	</t:script>

</t:task>

An initialization task for a topic should be written before the agent and the user start the discussion of the topic. The file DemoAppreciationGenerator.d4g.xml provides examples on where initialization tasks should be placed in the scenario.

Step 5: write locations where appreciation tasks could be triggered.

You don't want the ECA to trigger an appreciation task anywhere in the dialogue, because it can lead to some odd dialogue transitions. For this reason, you have indicate the location where an appreciation task could be launched. To do that, write a task step at the chosen location in the following form:

<t:step name="appreciationProcess" task="AppreciationProcess"/>

Examples are provided in the scenario file DemoAppreciationGenerator.d4g.xml, such as this one:

<t:task id="ObjetSoldat">
	<t:subtasks id="subObjetSoldat">
		<t:step name="vuSoldat" task="VuSoldat" />
		<t:step name="appreciationProcess1" task="AppreciationProcess"/>
		<t:step name="periodeSoldat" task="PeriodeSoldat"/>
		<t:step name="appreciationProcess2" task="AppreciationProcess"/>
		<t:step name="questionStyleStatue" task="QuestionStyleStatue"/>
		<t:step name="appreciationProcess3" task="AppreciationProcess"/>
		<t:step name="diraitHercule" task="DiraitHercule"/>
		<t:step name="appreciationProcess4" task="AppreciationProcess"/>
	</t:subtasks>
</t:task>

In this example you can observe 4 locations where an appreciation task could be triggered. Keep in mind that the Appreciation Generator Module decides whether to trigger the appreciation task or not, and that only one appreciation task can be triggered for the same target (which is here the topic name).

Step 6: write the properties file of the DISCO dialogue scenario.

For each initialization task in your dialogue scenario with an id InitializationTaskId, write:

Propose.Should(InitializationTaskId)@generate = false

This will prevent DISCO from generating this task outside of your dialogue scenario.

The 4th speaking turn of an appreciation task will be automatically added by DISCO, because it adds a user's turn after an agent's turn if a user's turn was not specified in the dialogue scenario. The default sentence for this user's turn is "ok". In an appreciation task, it should "free answer (optional)" instead of "ok". To replace "ok" by "free answer (optional)", write:

Ok@format = free answer (optional)

For example, the file DemoAppreciationGenerator.properties contains:

Propose.Should(InitTopicObjetSoldat)@generate = false
Propose.Should(InitTopicObjetBaiserDeKlimt)@generate = false
Propose.Should(InitTopicObjetLeconAnatomie)@generate = false
Propose.Should(InitTopicObjetChienBallon)@generate = false
Propose.Should(InitTopicObjetCompositionA)@generate = false
Ok@format = réponse libre (optionnel)

References

Sabrina Campano, Chloé Clavel, Catherine Pelachaud. "I like this painting too": when an ECA shares appreciations to engage users. International Conference on Autonomous Agents and Multiagent Systems, 2015.

Getting started with Greta

Greta Architecture

Quick start

Advanced

Functionalities

Core functionality

Auxiliary functionalities

Preview functionality

Nothing to show here

Previous functionality (possibly it still works, but not supported anymore)

Clone this wiki locally