Dialogflow: Not able to identify simple phrases - dialogflow-es

Not able to identify simple phrases like "my name is not Harry, it's Sam".
It is giving me name as harry and company name as Sam, Since name and company name was required in the same sentence.
It should have taken name as Sam and prompted the user again for company name OR should have given complete fallback.

Hi and welcome to Stackoverflow.
Dude. This is not a simple phrase.
Negative questions are always very difficult to catch by Dialogflow.
Suppose I have a question like,
I want to check *google* revenue for the year *2017*
As you can see, google and 2017 are the entities.
But now in the same way if you say,
I don't want to check *google* revenue for the year *2017*
The chances of hitting that old intent is very high as dialogflow matches almost 90% of this sentence with your old sentence. So it might fail.
Hope you are trying to ask something similar to this.
Anyhow coming to your point, If company name and name are different entities, then
Two things you can avoid:
As everyone mentioned,check your entities. The values should not be present in both the entities. This will fail because dialogflow will not know whether it should treat 'Sam' as your name or company name.
If you are not using the values from an entity, instead using '$ANY', then It has a very high chance of failing. And If you are using Dialogflow's system entity like, $given-name, then that is also not preferred as it does not catch all the names. So avoid these entities.
Things you can try:
Train Train And Train. As you would be aware, the training section in dialogflow is pretty good. Train it a few times and it will automatically learn and master it.
But , please note: Wrong training will result in wrong results. It should be 100% accurate. Always check before you approve a training.
And try using webHooks, actions, and/or events to figuring your way out from an external API.

Related

Best way for synonyms if data is stored outside dialogflow?

I want to create a chatbot. One of the intents is who-is which allows users to ask "Who is" for Arabic names to get information on a person. I have people stored in a database (firestore). I would like the user to say "Who is Saalih Uthaymeen?" But they may ask "Who is Shaykh Saalih al-'Uthaymeen?" as well. The names are different, but they're the same really. And they're close in spelling.
I noticed a synonyms feature in dialogflow, but I don't have the names stored in dialogflow so I don't know if it's useful. Since the synonyms have similar spelling, can't dialogflow help? Otherwise, I see the following options:
Option 1. Manually create every name and its synonyms in dialogflow.
This is manual hard work. Even if I programmatically enter every name, I have to manually enter every synonym. And I have 2 or 3 hundred names.
Option 2. Manually create synonyms in my database.
Basically, I have a table of people... so I would create a new table mapping every person to every synonym possible for his name. Since the spellings will be very similar, I'm confident this is a waste of work and time.
Is there any other option Dialogflow offers?

Dialogflow dont recognize phonenumber

Im tring to create a booking system for a restaurant so the assistant go to ask to user number of guest, time and day to reserve, and finally the name and the phone number of guest! But many time the phonenumber is confused by the guest number.
I set in parameters for #guest the value of #sys.number and for $telephone the entity of #sys.phone-number, but sometimes get wrong recognize. I could make it work?
The Dialogflow team has a really full-featured example on Github here (it's a bike shop, rather than a restaurant, but most of the functionality is the same). Give it a look for some inspiration.
Regarding the specifics of recognizing phone numbers: I'd recommend adding a bunch (like more than 10) of example training phrases to the appropriate Intent that include phone numbers. Often the problem with matching these things is just a matter of the number of examples the system gets to learn from.
Good luck!

how to validate user expression in dialogflow

I have created a pizza bot in dialogflow. The scenario is like..
Bot says: Hi What do you want.
User says : I want pizza.
If the user says I want watermelon or I love pizza then dialogflow should respond with error message and ask the same question again. After getting a valid response from the user the bot should prompt the second like
Bot says: What kind of pizza do you want.
User says: I want mushroom(any) pizza.
If the user gives some garbage data like I want icecream or I want good pizza then again bot has to respond with an error and should ask the same question. I have trained the bot with the intents but the problem is validating the user input.
How can I make it possible in dialogflow?
A glimpse of training data & output
If you have already created different training phrases, then invalid phrases will typically trigger the Fallback Intent. If you're just using #sys.any as a parameter type, then it will fill it with anything, so you should define more narrow Entity Types.
In the example Intent you provided, you have a number of training phrases, but Dialogflow uses these training phrases as guidance, not as absolute strings that must be matched. From what you've trained it, it appears that phrases such as "I want .+ pizza" should be matched, so the NLU model might read it that way.
To narrow exactly what you're looking for, you might wish to create an Entity Type to handle pizza flavors. This will help narrow how the NLU model will interpret what the user will say. It also makes it easier for you to understand what type of pizza they're asking for, since you can examine just the parameters, and not have to parse the entire string again.
How you handle this in the Fallback Intent depends on how the rest of your system works. The most straightforward is to use your Fulfillment webhook to determine what state of your questioning you're in and either repeat the question or provide additional guidance.
Remember, also, that the conversation could go something like this:
Bot says: Hi What do you want.
User says : I want a mushroom pizza.
They've skipped over one of your questions (which wasn't necessary in this case). This is normal for a conversational UI, so you need to be prepared for it.
The type of pizzas (eg mushroom, chicken etc) should be a custom entity.
Then at your intent you should define the training phrases as you have but make sure that the entity is marked and that you also add a template for the user's response:
There are 3 main things you need to note here:
The entities are marked
A template is used. To create a template click on the quote symbol in the training phrases as the image below shows. Make sure that again your entity is used here
Make your pizza type a required parameter. That way it won't advance to the next question unless a valid answer is provided.
One final advice is to put some more effort in designing the interaction and the responses. Greeting your users with "what do you want" isn't the best experience. Also, with your approach you're trying to force them into one specific path but this is not how a conversational app should be. You can find more about this here.
A better experience would be to greet the users, explain what they can do with your app and let them know about their options. Example:
- Hi, welcome to the Pizza App! I'm here to help you find the perfect pizza for you [note: here you need to add any other actions your bot can perform, like track an order for instance]! Our most popular pizzas are mushroom, chicken and margarita? Do you know what you want already or do you need help?

Steering Alexa towards a specific slot value response

I've defined a custom slot types in the Amazon Developer console, the slot contains a list of names, as below.
homer simpson
ned flanders
principal skinner
comic book guy
I've then defined the sample utterances as below.
PlayAudio to play {Name}
So in the end, I want the user to be able to say something similar to the folliowing:
Alexa, ask the simpsons to play homer simpson
Alexa, ask the simpsons to play ned flanders
Alexa, ask the simpsons to play principal skinner
Alexa, ask the simpsons to play comic book guy
Of course, there is an extremely high chance that Alexa will hear the name incorrectly, so I need to be able to match the name that is heard as closely as possible one of the slot values.
How would I go about doing this, would I have to code it in the function or is there a better way?
When using custom slots, there is a chance that Alexa will provide a value not in the list. This gets specially problematic as the list grows in size. Using the beta testing functionality as Tom suggested can help but you won't be able to catch all the issues and eventually this will not scale.
I found out that the only way to completely ensure you are getting a value from your list is to have the full list in the skill and check against it every time. In order to check, exact matching is not always the best option and I've tried two approaches:
String Edit Distance functions: work well when a used may say incomplete utterances or add words to the utterances in your list. Check: https://en.wikipedia.org/wiki/Edit_distance
Acoustic/Phonetic: relatively easy to implement may work better for identifying foreign words or proper names. You can preprocess your list for quick comparisons. Check: https://en.wikipedia.org/wiki/Soundex
You are right that there is a high chance 'that Alexa will hear the name incorrectly'. My solution is to do a bunch of trial and error with human testers to discover what the common mis-interpretations are, and then hard-code fixes for those.
So I get a tester to say the different names and make a record of what they said. I then look at what Alexa gives me as the slot value, and where there are discrepencies I add a hard-coded substitution to my skill.

Named Entity Recognition - Do we need an external list to match results?

I am not an expert in Machine Learning, so I will try to be as accurate as possible...
I am currently analyzing financial documents that are giving information on a specific fund. What I would like to do is to be able to extract the fund name.
For this, I am using Named Entity Recognition (NER) in Azure Machine Learning platform. After analyzing approx. 100 documents, I get results classified as Organizations. In most cases, they are really organizations. This is great, but my problem is that the fund name is also categorized as an organization. I am not able to distinguish between a company name and a fund name.
From some readings on Internet, I could discover that Gazette system could help so that we can match the recognized organizations against a list of funds, and therefore make sure that we have a fund name.
Do you think this would be a good approach? Or is there any other algorithm that I should try to improve the results?
Thanks for any suggestion!
NER has its origins in identifying text identifying broad semantic categories, like the names of people or organizations (companies) in your case. Reading the description of question, I don't think this is the problem you really want to solve. Specifically you mention:
that Gazette system could help so that we can match the recognized organizations against a list of funds
I suspect the problem you really want to solve is one of semantic interoperability - you want text from your NLP program to match a list you have that is part of another system. In that case, the only accepted way you are going to solve your problem is to map all of the input text to a list/common standard - ie) use the gazetteer. So you are on the right path.
The only caveat is that if you only need to distinguish between funds and other types of organizations - without the need to match the results against a list. If that is the case, you write a classifier to distinguish funds from everything else and you can avoid mapping to your list entirely. Otherwise use a gazetteer.

Resources