...
The intent for filtering recipes is one of the most important intents. It is used to filter recipes for the user based on a variety of criteria. This is the first intent that employs all the entities we have created. In the user expressions, where the user is asking to filter, all different entities need to occur and be tagged in the set of examples. For example, for a training phrase like “I want a Chinese recipe”, ‘Chinese' needs to be tagged as ‘cuisine’, so this phrase can be parsed by Dialogflow in order to apply the filter ‘cuisine’ to the recipes in our database. The ‘addFilter’ intent can be found in the project provided to you to start with , and should be uploaded in Dialogflow by you.
...
To filter the recipes for the user in the way they intend, their utterances are mapped onto the intents and entities you specified in Dialogflow. This then returns the identified intent (for example, ‘addFilter’) and entity information (for example, cuisine - ‘Chinese’). The MARBEL agent must be able to use this information. In order to make this happen, you need to create Prolog rules to filter the available recipes in the Prolog database. This can be done by introducing the following Prolog predicates. We have already specified the heads of all rules in the recipe_selection.pl
file. That is where you still need to add the bodies for these rules. We need a few helper functions before we can start implementing code for filtering, which are described next. For each rule, you first need to uncomment it.
nrOfIngredients
We will start off easy.
...
There are a number of different rules that you need to implement for the applyFilter/4
predicate, depending on the specific filter that needs to be applied. For example, filtering recipes for a cuisine asks for a different rule than filtering for the duration of a recipe. These variants are specified in the table below. For each rule, you first need to uncomment it.
applyFilter
Code Block |
---|
applyFilter(+ParamName, +Value, +RecipeIDs, -FilteredRecipes) |
...