Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip

Before you start anything make sure your agent is connected to Dialogflow:

Dialogflow: Connecting Dialogflow Agent to Our Agent

Make sure your naming is precisely the same for intents and entities as the ones given or you will run into issues later on! 

...

Predicate Description

Rule Head

Notes/Instructions

The predicate to filter recipes on cuisines (e.g., Italian recipes) 

applyFilter('cuisine', Value, RecipeIDsIn, RecipeIDsOut) :-

  • The input Value, in this case, is a string Value, and to make sure it compares to what is in the database we need to make sure it is all lowercase. You can do this with ‘downcase_atom’.

Predicate to filter recipes that meet the dietary restrictions (such as ‘vegetarian’).

applyFilter('dietaryrestriction', Value, RecipeIDsIn, RecipeIDsOut) :-

  • Use the function above you defined in your goal and This rule should filter recipes based on their membership to dietary restriction. To check if a recipe is a member of a dietary restriction you can use the built-in Prolog member/2 predicate.

  • (member(Recipe, List of Recipes), diet(Recipe, List of Recipes in Diet))

Predicate to filter recipes on the max amount of time

applyFilter('duration', Minutes, RecipeIDsIn, RecipeIDsOut) :-

  • Your condition/goal will ideally have three components, one of which is member/2

Predicate to filter easy recipes

applyFilter('easykeyword', _, RecipeIDsIn, RecipeIDsOut) :-

  • You made a rule for this!

Predicate to filter recipes on the exclusion of a specific ingredient 

applyFilter('excludeingredient', Ingredient, RecipeIDsIn, RecipeIDsOut) :-

  • There is a predicate in ingredient_hierarchies.pl which one could consider useful

Predicate to filter recipes on the exclusion of a specific ingredient type (for example: ‘beef’)

applyFilter('excludeingredienttype', Ingredient, RecipeIDsIn, RecipeIDsOut) :-

  • The body of this rule is similar to the ‘exclude ingredient’ rule (the difference between ingredient and ingredient type is catered for in ingredient_hierarchy.pl)

Predicates to filter recipes on a specific ingredient inclusion

applyFilter('ingredient', Ingredient, RecipeIDsIn, RecipeIDsOut) :-

  • Do your best!

Predicate to filter by including an ingredient type 

applyFilter('ingredienttype', Ingredient, RecipeIDsIn, RecipeIDsOut) :-

  • The body is the same as the ingredient rule above

Predicate to filter recipes on meal type (for example: breakfast)

applyFilter('mealType', Value, RecipeIDsIn, RecipeIDsOut) :-

  • Downcase_atom the Value input for compatibility 

Predicate to filter recipes on a maximum number of ingredients

applyFilter('nrOfIngredients', Value, RecipeIDsIn, RecipeIDsOut) :-

  • Value inputs are an atom/string, check utils.pl

Predicate to filter recipes on a maximum number of steps

applyFilter('nrSteps', Value, RecipeIDsIn, RecipeIDsOut) :-

  • Do your best!

Predicate to filter recipes and return fast recipes. A recipe is fast if it takes less than 30 minutes 

applyFilter('shorttimekeyword', _, RecipeIDsIn, RecipeIDsOut) :-

  • Do your best!

Predicate to filter on the number of servings 

applyFilter('servings', Value, RecipeIDsIn, RecipeIDsOut) :-

  • Do your best!

Predicate to filter recipes on a tag (for example: pizza) 

applyFilter('tag', Value, RecipeIDsIn, RecipeIDsOut) :-

  • tag(RecipeID, Value) could be useful in your goal 

...

This marks the end of the basic implementation of the Natural Language Understanding of your agent. Make sure to properly test each intent, entity and rule that you have implemented (further detailed in the System testing section).