Grouped nouns as a filter

(dbla) #1

Hi,

How would I do the following:

I want the user to ask if he / she is allowed to bring [noun] to camp. I started of by creating a trigger which looks for the following:

can i bring a
can i have
am i allowed to bring
am i allowed to have
etc…

Now what i would like to do is create a group of nouns and use that group to run against the contains filter. For example If the user were to ask “Can i bring a dog” It would check the [allowed-pets] category which contains a list of all the pets that are allowed in camp. Currently

I am doing the following as a workaround for the moment but as you can see its going to become very difficult to maintain.

{{new_message.message}} contains cat
-or-
{{new_message.message}} contains dog
-or-
{{new_message.message}} contains fish
-or-
{{new_message.message}} contains pig

Any ideas / suggestions are welcome!

Thanks!

(Daniel Beckett) #2

Hi @dbla,

You could group trigger words into phrase groups. See the ‘Word or Phrase Grouping’ section for Bot Triggers & Actions for full information.

The general idea is that you setup trigger words into groups like so:
Cat [pets]
Dog [pets]
Fish [pets]
Pig [pets]

And then on a filter you can just use:
{{new_message.group}} equals pets

(dbla) #3

Thanks Daniel!

From my understanding this would trigger everytime the word cat or dog came up. So it would come up in scenarios where the user said “i like dogs” instead of “Can i bring a dog”

Would I be able to do something like this:

Lets pretend they said “Can i bring my dog”

Create a flow message trigger - If any of the following is said it calls a new trigger

Can i bring
Can i have
Are we allowed to

The flow above then passes the entire message to the “Allowed / Not Allowed” Items flow

Which then has the appropriate triggers set up.

cat [pets]
dog [pets]
monkey [pets]

Would something like that work?

Thanks!

(Daniel Beckett) #4

I think you’re starting to verge a bit more on the side of Natural Language Processing (NLP) which is a bit more advanced than the built in Word & Phrase Matching. If you did want to judge the intent of a user’s message and run actions based off that then the following guide could help out in getting setup with DialogFlow which can do NLP.