Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
Entity for number of ingredients and number of recipe steps
...
Another way to improve your Dialogflow agent is to enable a user to include multiple requests in a single user expression. You can achieve this simply by including many more phrases such as “I’d like a Chinese recipe with less than 8 ingredients”. This will ensure that your conversational agent can recognize multiple filter requests.
Prolog and Patterns
Retrieving the (number of) ingredients and recipe steps
...
Now add a similar rule that applies a filter for the nrOfSteps feature; your Training phrases should dictate how to read the constraint. I.e., if your phrase says “less than N recipe steps” than you should write code that implements the filter to mean exactly that.
Add a similar rule that applies a filter for the servings feature. You probably want to make sure that a recipe has exactly the right number of servings that the user asked for.
Finally, add a rule that applies a filter for the duration feature. This feature is a bit more tricky and you should take the warning above about data types to heart. However, most of the work has already been done for you in the
dialog_update.mod2g
file in a step called Pre-process parameters of intent. In this step, the duration values received from Dialogflow are transformed to minutes (numbers) using theduration_to_min
predicate defined in theutils.pl
file. This means that to define the rule for filtering, you simply need to look up the time it takes to cook a recipe in the database (specified in minutes), and compare that value with the maximum duration that the user specified.
Visuals
Extend the recipe confirmation page
...
Info |
---|
All done? Proceed with https://socialrobotics.atlassian.net/wiki/spaces/PM2/pages/2216001572/BuildingDesigning+and+Developing+Your+Agent#Agent-Capability-6%3A7%3A-Filter-Recipes-by-Exclusion-Recipe-Categorical-CharacteristicDietary-Restrictions |