Dialogflow
Tip |
---|
Before you start: make sure your MARBEL agent is connected to Dialogflow: |
...
Greeting Intent
Make an intent called ‘greeting’`greeting'.
Under ‘Training Phrases’ `Training Phrases' add a number of expressions (at least 10) by which a user may greet - try and be thorough. For inspiration, do a Google search for ‘greeting `greeting phrases’. You may find, for example, useful phrases here: 20 Greetings in English.
Under ‘Action `Action and parameters’ make sure the box above the table is filled in with the name of your intent as shown in the image below.
...
Tip |
---|
Check that your ‘greeting’ intent is working by using the microphone button in the test console inside DIalogflow. |
Prolog and Patterns
You and your team should think of a name for your agent. Feel free to be creative. We need to tell our agent its name somewhere. If you look at dialog_init.mod2g you can find on line 40 a place to define the name of your agent in a string → insert(agentName('Bellabot')
.
...
c10 Greeting with No Introduction
To make a pattern, you need to use the Prolog predicate ‘pattern(_)’. This pattern([PatternID | Sequence])
. Note that this predicate only takes one a single list argument, which should take the form of a prolog listbut this list should always have the same structure: the first item in the list should be a PatternID
or name of the pattern, followed by a sequence of Actor-Intent pairs (more on this below).
We shall start by considering how a greeting could go. When the agent does not introduce itself, the most common greeting pattern would look as follows:
...
This pattern will be quite similar to the one above, but should include the predicate intent label 'selfIdentification'. Add a list [_,_]
predicate in the pattern list above for the new rule that tells the agent to self-identify. Also, note that the agent must have a name in order to self-identify.
c10 responses.pl
In the Prolog file responses.pl
we determine how exactly the agent responds in a patternwill respond to something a user said, using the intent label from a pattern that indicates what type of response the agent should give. This is done with using the predicate text(
_Intent,
_Text)
where the . The first argument should correspond to the intent the agent has Intent
of the text/2
predicate should be instantiated with an intent label of the agent, and the second argument is Text
should be a string atom with the text you want your agent to say. So, for example, in the case of the c10
pattern, we use the agent intent seen used in the pattern ‘greeting’ 'greeting' pattern([c10, [agent, greeting], ___])
. So Add the new fact we add text/2
fact for the intent label greeting
under the % Intent: greeting
comment. The full predicate could be for example . An example fact that you can add. for example, is text(greeting,
“hi”"hi").
Next, we need to build the rule for selfIdentification.
...
You should then return a sentence including the agent’s name as Txt.
Visuals
Opening Page (visuals for the c10 pattern)
...