Having issues with email and person entities in the same intent - dialogflow-es

We have an intent which catches a person's name and email. Below is how our training data looks.
The problem is with utterances which contain just name and email, without additional phrases around. As we are using it in SMS conversation, I guess that it could be quite often the case.
For example if user types in "Mark Randel gone#hotmail.com", we will get name: Mark and email: Randelgone#hotmail.com
I noticed that if we enter an exact phrase as it is in one of the utterances in training phrases, we will get the right result, but obviously, we can not add all possible combinations here.
Would it be expected that recognition will improve if we add additional 20-30 training phrases with various just name and email combinations? This would be kind of strange, because, what is the point of system entities in that case?
Has anyone had a similar issue?

In Dialogflow ES, default #sys.email entity allows empty string for extracting email. I think this cause the problem.
You use regexp entities with email regex, so that you might be able to extract only valid email string.
EDIT
In my environment, I created regex custom entity for extracting email.
Entity
regex : [\w-\.]+#([\w-]+\.)+[\w-]{2,4}
Test
input : Mark Randel gone#hotmail.com
output :
parameters
value
person
{'name': 'Mark Randel'}
regex-email
gone#hotmail.com

Related

How to provide dynamic answer for the selected entity as parameter in dialogflow fulfillment

I have an entity (items) and its values are ('name', 'colour', 'awards')
I have three intents
Intent1 = Welcome Intent (user will get the options in the form of chips)
Intent2 = Select Option (bot will ask question to enter detail for selected option)
Intent3 = Update Option (bot will save the record and ask next option to update.)
Example -
bot: welcome! what you want to update? name, colour, awards.
user: name
bot: Enter your name.
user: John
bot: record updated, what to update next? name, colour, awards.
now the issue is awards have multiple fields to update, to update awards a user has to provide three things (award name, award date, award description)
What I want is when a user selects awards options from the chips then it should be taken to new intent where I will get all the data through slot filling.
The first thing to remember is that an Intent represents what the user has said and not what you are doing with what they have said. So it doesn't make sense to say that you are "going to an Intent".
Second, while slot filling seems like a good idea, it usually leads to further problems, since it doesn't handle conditional information well, or handle users if they skip around in what they want to update.
All of these are better solved by setting up a state machine where they are in the conversation, what information you need, and what they have provided so far. Based on these settings, you can prompt them yourself for what you expect next. (You may also find using one or several Dialogflow contexts useful for shaping how to accept results as well.)
So, for example, when the user has indicated they are updating the awards, it might work like this:
User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?
User: Merit
[This matches the Fallback Intent with an Input Context for 'awards', since it is free-form input. Your fulfillment stores this and sets the 'awards' context with a parameter that we are now prompting for the date.]
Bot: Got it, the award is named Merit. When was it awarded?
User: Today
[This matches an Intent with a training phrase of "<#sys.date>" and the Input Context of 'awards'. There are also training phrases for things like "It was awarded <#sys.date>" and so forth. Your fulfillment sets the date and sets the 'awards' context with a parameter that we're now prompting for description.]
Bot: Got it. Awarded on March 1st. What is the description?
User: They were awesome.
[This matches the Fallback Intent with the Input Context of 'awards' again, because it is still free-form input. Our fulfillment, however, knows that this is about the description this time, so it stores it and removes the 'awards' context since we've captured everything.]
Bot: I've recorded that as a description of "they were awesome" - sure thing. That was everything we needed for now. Do you want to update the name, colour, or awards next?
That all seems pretty straightforward. But consider if the conversation had gone this way:
User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?
User: [Having done this many times] They were given the award for Honor yesterday
[This might match an Intent with an Input Context of 'awards' and the training phrase of "Given the award for <#sys.any> <#sys.date>" and possibly "<#sys.date> they got an award for <#sys.any>". Your fulfillment sets the name and date from this, sees what information it still needs, and prompts with...]
Bot: Got it. Award named Honor. Awarded March 1. What is the description?
User: Actually, it is named Honorable Service
[This matches an Intent with a training phrase of "named <#sys.any>" and an Input Context for 'awards'. Your fulfillment changes the name stored, checks what we still need, and again prompts...]
Bot: Ok, I've changed the award name to Honorable Service. What is the description?
The first scenario could be handled by slot filling and simple prompting, but the second can't. Being able to handle more natural responses from people and more flexible prompting will be better for your users.

DialogFlow: Respond appropriately to name that ends in "s" or when user inputs a possessive name without an apostrophe

How can Dialogflow distinguish appropriately between the following questions for example:
Show me Frances' account
Show me Frances's account
Show me Frances account
Show me Francess account
Looking for the response to be correct such as:
Here is Frances' account
or
Here is Frances's account
I'm using the #sys.person entity but often its not recognizing the variations properly. I've tried training about 10 examples and still having troubles.
If you want Dialogflow to improve at recognizing 's or s behind a persons name you can use composite entities. These composite entities allow you to look for a value in a certain pattern, which in your case could be [person]'s, [person]', [person]s and [person]
If you use the #sys.Person entity in this new composite entity, it should work for any name that is recognized by the #sys.Person entity. So you don't have to write an example for each persons name.

#sys.email returns emails with other parts of the input amended, including whitespaces

#sys.email is sometimes returning extra parts of the user's input, including whitespaces. For instance:
input: "My e-mail is asdf#asdf.com"
And my #sys.email parameter is set as "is asdf#asdf.com"
I have around 150 training phrases in my intent on how to retrieve an email.
Like "My email is asdf#asdf.com" where the email is a parameter #sys.email:email, and a bunch which are email like examples, like "jsdnfknj#skjdnf.com".
I also added a template "My email is #sys.email:email".
I wonder if this is just a matter of more training needed or if there is something wrong with #sys.email.
When you say...
And my #sys.email parameter is set as "is asdf#asdf.com"
...do you mean that you've tagged "is asdf#asdf.com" as #sys.email? If so, make sure that you're only tagging the email address itself as #sys.email in your training phrases. Avoid tagging any extraneous words like "is".
Try cleaning up the entity tagging in your training phrases and see if that makes a difference.

Is there an easy way to create a "Movie-name" entity in dialogflow

I want to create an action that takes the name of a Movie or Tv show and returns some details about it.
The problem is that I need to add all the possible tv show names to an entity.
Even then there is the limit of 3000 for the maximum number of entities in an Entity. Is there a way around this problem?
Ideally I would like to give it some sample tv show names and when the user says a new tv show name(one that the entity doesn't contain), it is able to recognise it and pass it on to the intent.
You should create a custom entity, and train it with as many examples as you can. Additionally, mark the allowed automatic expansion, so that dialogflow will be able to recognize the names which you have not defined.
The problem could still be there, that dialogflow might recognize something as movie name which is not a movie name, for that you should have a validation function in your webhook code. If validation fails, you can prompt the user again for correct movie name.

how to train a bot's intent for a user phrase not known?

I have to train my dialogflow bot with a phrase i dont know i.e user can type anything he or she wants but i want that to work with a single intent only.
for example:
U- Good Morning
B- Morning how can i help you?
U- i want to create a ticket
B- Please provide a subject for the issue?
U- No i want to view a ticket with id ABC1234556
Now here bot should back track to another intent which will view the details related to the ticket id but thats not happening i am using dialogflow's system entity i.e #sys.any which captures anything user says. This entity captures anything and even back tracks on other intent's phrases like bye show all ticket's and etc but it just not works with this particular intent phrase!
I hope i have made clear what is bothering!
If you're using #sys.any in an intent to capture all user input after asking Please provide a subject for the issue, it won't be possible for another intent to be matched within Dialogflow.
To get around this issue, you could change your agent design, perhaps by confirming the "subject" in case the user wants to change path.
You could also try and match an intent to whatever text is captured by #sys.any, by calling Dialogflow's detectIntent endpoint from your webhook. However, this might result in unwanted behavior (e.g. if a legitimate ticket subject happened to match one of your intents).

Resources