Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
typelist
printablefalse

Dialogflow

deleteFilterValue 

‘deleteFilterValue’ is useful to deal with a scenario where the user requests to remove a filter that they have already put on specifically. For example, “I wish to remove the onion filter”, “Forget about excluding broccoli”, and “Can you delete the Chinese cuisine”. Add some training phrases with all the different filters that could be deleted.

...

The ‘noMoreFilters’ intent is used when the user does not want to add any more filters to their recipes list and wishes to see the available recipes.

Prolog and Patterns

a21noMoreFilters 

Example:

...

In responses.pl we have to make two rules, for ‘grantPicture’ and ‘pictureNotGranted’. An agent can allow the list of recipe pictures to be shown if the list is less than 100 recipes long. An agent cannot grant the recipes if the list is over 99 recipes long. The ‘recipesFiltered’ predicate provides a list of the filtered recipes. Fill in the two rules with the corresponding conditions.

featureInquiry intent

Multiple text predicates take the argument feature inquiry in responses.pl. Each feature inquiry response is different based on how many recipes there are left to filter.

First Rule for Large Number of Recipes

We want to prompt the user for more specific preferences if there are too many recipes. The rule will be triggered when the length of the list of recipes is greater than 890.

  • Start with the text/2 predicate, where the first argument is featureInquiry.

  • The second argument will be the response text "What kind of recipe would you like?".

  • Use the recipesFiltered/1 predicate to get the list of recipes.

  • Use the length/2 predicate to determine the number of recipes.

  • Set a condition that the length L must be greater than 890.

Second Rule for a Moderate Number of Recipes

If there's a moderate number of recipes (more than 15 but fewer than 891), we ask the user to add more preferences unless a certain memory key-value pair is set.

  • Repeat the initial steps as the first rule.

  • The response text will change to "What other preference would you like to add?".

  • Set the length condition to be less than 891 and greater than 15.

  • Include a condition using not/1 to check that the memory does not have the key-value pair 'show', 'true'.

Third Rule for No Recipes

If there are no recipes after filtering, we want to inform the user to remove some requirements.
  • Use the recipesFiltered/1 predicate again.

  • The response text will be "There are still no recipes, please remove more requirements.".

  • Check that the length L is equal to 0 using L=0.

Fourth Rule for a Small Number of Recipes or a Show Command

This rule handles two scenarios: either there's a small number of recipes, or the user has explicitly asked to show the recipes despite the number.

  • Start with the text/2 predicate for featureInquiry.

  • The response text will be "Here are some recipes that fit your requirements.".

  • Use the recipesFiltered/1 predicate to get the filtered list.

  • Create a condition that checks if the length L is less than 16 but more than 0, or if the memory key-value pair 'show', 'true' exists. This condition is composed of two parts joined by a semicolon ;, representing a logical OR.

Removed Filter

Add this predicate to the responses.pl file in the indicated spot.

Code Block
% used in a21removeKeyFromMemory for handling deleteParameter. 
text(removedSpecificFilter(DelFilter), Txt) :- 	convert_to_string(DelFilter, Str1), 
	string_concat("I removed the ", Str1, Str2), 
	string_concat(Str2, " requirement.", Txt).

Visuals

Nothing we ask you to do here for this capability. It’s up to you.

...