Versions Compared

Key

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

...

It is not necessary to add phrases that are completely unrelated to the topic of our recipe recommendation agent, as these would definitely come back as an unknown intent. Thus, what you should do is think of related phrases that would be close to an intent but should not match with it. For example, “I do not like mushrooms” is food related and refers to an ingredient entity ‘mushroom’. Yet, you might argue that it should not be matched to any of the intents you specify , because you do not want users to discuss their likes and dislikes with your agent. Alternatively, you could also argue to include ‘I like’ and ‘I dislike’ as training phrases for filtering by something. But that is a design decision for you to make! The Fallback Intent should be updated as you add more intents throughout the project.

...

Note

If the word you enter for an entity entry has synonyms, enter these as synonyms rather than adding these as different entity entries!

...

  1. timeKeyWord - words that refer to measurements of time (hour, minutes, etc.)

  2. shortTimeKeyWord - for example ‘fast’, ‘quick’ etc.negationKeyword - to specify that something needs to be omitted (for example ‘without’ or ‘don’t’)

  3. easyKeyWord - to specify recipes that are not hard to make (for example ‘simple’)

When you are done your Entities page should look as followshave the following entities:

...

The ‘addFilter’ Intent

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.

...

In the diet rule, we need to find all the ingredients that a certain recipe has and then input them into a new function we shall create below diet, called ‘ingredientsMeetDiet’. This function should return a diet should work if the list of ingredients that fit of the inputted RecipeID fits the dietary restriction . This list should be returned with the name inputted DietaryRestriction.

Code Block
ingredientsMeetDiet([ Ingredient | Rest ], DietaryRestriction) :-

The ingredientsMeetDiet predicate is our stop clause, which should take a list of ingredients and check if each one meets a dietary restriction. It has a stop clause that is in the file already and will recursively check each ingredient and return ‘false’ when an ingredient does not meet the given dietary restriction. The predicate ‘typeIngredient’ can be used to check if an ingredient meets a dietary restriction. Fill in the body of the rule for ingredientsMeetDiet. 

...

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) :-

  • 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 DietDietary Restriction))

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 

...