LUIS does not recognize names with spaces - bots

So I got a bot built with Microsoft Bot Framework and it's using the LUIS API for text recognition. With this bot, I'm able to ask about information about different devices that I got in my backend. They got names like Desk, Desk 2 and Phone Booth 4. The first and second name works just fine but whenever I send a name that contains 2 spaces or more, LUIS will fail to recognize it. I have added all the names to a feature list on LUIS but it doesn't seem to do anything. When I'm in the bot code executes the method for that intent, the entity is just null whenever I send this kind of names. Any idea how I might solve this? As I described, names with just one space like Desk 2 works just fine. Maybe there is a way to save multiple words as an entity inside LUIS?
In the image below, the top entry is "show me phone booth 4" and the bottom one "show me desk 2".

It'll take a little leg work, but have you tried updating your model programmatically?
On the LUIS API reference, you can label individual utterances or do it in batches. The benefit of doing it this way is that you can select what should be recognized as an entity based on index position.
Example:
{
"text": "Book me a flight from Cairo to Redmond next Thursday",
"intentName": "BookFlight",
"entityLabels":
[
{
"entityName": "Location::From",
"startCharIndex": 22,
"endCharIndex": 26
},
{
"entityName": "Location::To",
"startCharIndex": 31,
"endCharIndex": 37
}
]
}
I admit I haven't attempted to do this before, but I do not see how labeling/training this way would logically fail.
One thing I do note about your entities is that they're composed of an item and also a number. You could throw them into a composite entity; but in this case doing it the way I mentioned above is a good way to do what you're looking for.
That said, if you plan on using the office-furniture-pieces(?) as entities for a separate intent, say, 'PurchaseNewOfficePieces', it might pay to create use a composite entity for 'Desk 2' and 'Phone Booth 4'.

Related

Difficulties with combined words as entities in Dialogflow

I'm trying to write an intent in Dialogflow that requires the user to fill both a room as well as an object.
I need to determine if the room is part of a house (check in entity 1) and if the object is made of glass (check in entity 2).
In English, for instance, that would result in '[kitchen] [window]', however I have to do this in Dutch, where a lot of words are combined.
Users should be able to say 'the window of my kitchen is damaged', but in Dutch it is more natural to say 'keukenraam', so: 'my kitchenwindow is damaged.
This one word combines location and object, but I have not been able to use one word to fill two entities.
Does anybody have a good suggestion, because I can't find a proper solution for this problem.

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.

Dialogflow(Api.Ai) Doesn't recognize custom entity

I have been working lately with Dialogflow to make chatbots to do some simple tasks. For instance with webhooks and youtube api where the user ask to show him a video and then the bot just answers with the youtube video url.
E.G.
USER SAYS
Show me Neil young harvest moon
AGENT SAYS
Here you go : https://www.youtube.com/watch?v=n2MtEsrcTTs
I do this by using a custom Entity I called "YoutubeQuery" I checked "Allow Automated expansion" and unchecked "Define Synonyms" then I just added 2 values "Kavinsky Night Call" and "Indigo Night Tamino"
In my Intent I just made a couple of training phrases like these:
And everything works.
Now my issue is with a new Agent which I called Orders
I want just to get Order Id's from the firestore database, but before getting there I'm running in kind of a huge problem
I defined the order's ID entity just like the one with the youtubeQuery. And I added some example Order ID's , I want them all to Start with OD and have 4digits after example (DX0001,DX0009,DX9999)
Afterwards I made the intent
Now unless I give the EXACT order ID's from the traininphrase or the ID examples I defined in the Entity it will always give me a response with an empty parameter OrderID
I start my intent by saying "my order" then I get prompted with "What is your ID?
So when I give an ID that has not been used in the training phrases of the Intent I get an empty value in the parameters like this:
But when I give an ID that has been used in the training phrases like for instance the first one DX0808 it does work...
How can I make this work without adding all the possible order id's ranging from DX0001 to DX9999 in the training phrases or the entity.
I mean it does work for my youtube query, I can put anything there it does "catch" the value. Any help please?
It looks like the required parameter is the problem here, my suggestion would be to:
Create intent to get the order id in one sentence without reprompt (turn off required on the order id) and id is always present, ex: "my id is DX0402". Include training response where only ID is provided like "DL3932", ex. below:
Set other intent for scenario when customer wants to provide the id but it is missing, for ex. customer says: "my id" and make your bot ask for the id as an response ex. "ok, provide me your id"
If you do it, in case user doesn't provide the id, intent 2 will be triggered and after id is provided you'll trigger intent 1.
Hope this makes sense.

Complex Statements Intent Classification

Consider following sentences:
1) I want to watch movies watched by Srikanth but not by tarun
2) I want to watch movies of Christoper Nolan but not having Christian Bayle
3) I want watch movies watched by Srikanth but not liked by Tarun
The problem I am facing is -
Even though I can successfully define entities such as "not watched", "watched" , "not liked" , "having" , "not having" etc; etc;
Hence I will know what kind of action user is referring to.
I will also get to know names like Srikanth, Tarun, Nolan, Bayle etc;
But How do I establish Relationship between name and action. How do i know which action was related to which name.
I am not able to achieve this in LUIS / DIALOGFLOW.
What I feel is only way is to break statement into 2 distinct statements, How can we do that and is that a right approahc
We cannot directly assign multiple intents to the same utterance through LUIS. You can use NLTK along with LUIS to fix this issue as discussed here.
Another workaround is to create 2 apps with each intent and assign the same utterances and add the code which would differentiate the intent based on the keyword in the sentence.

Dialogflow matches irrelevant phrases to existing intents

I created a chatbot which informs the user about the names of the members of my (extended) family and about where they are the living. I have created a small database with MySQL which has these data stored and I fetch them with a PHP script whenever this is appropriate depending on the interaction of the user with the chatbot.
For this reason, I have created two intents additionally to the Default Fallback Intent and to the Default Welcome Intent:
Names
Location_context
The first intent ('Names') is trained by phrases such as 'What is the name of your uncle?' and has an output context. The second intent ('Location_context') is trained by phrases such as 'Where is he living?', 'Where is he based?', 'Where is he located?' 'Which city does he live in?' etc and has an input context (from 'Names').
In general, this basic chatbot works well for what it is made for. However, my problem is that (after the 'Names' intent is triggered) if you ask something nonsensical such as 'Where is he snowing?' then the chatbot will trigger the 'Location_context' intent and the chatbot will respond (as it is defined) that 'Your uncle is living in New York'. Also let me mention that as I have structured the chatbot so far this kind of responses are getting a score higher than 0.75 which is pretty high.
How can I make my chatbot to trigger the Default Fallback Intent in these nonsensical questions (or even in more reasonable questions such as 'Where is he eating?' which are not however exactly related with the 'Location context' intent) and not trigger intents such as the 'Location_context' which simply contain some similar keywords to it such as the word 'Where'?
Try playing around with ML CLASSIFICATION THRESHOLD in your agent settings (Settings > ML Settings). By default it comes with a very low score (0.2), which is a little aggressive.
Define the threshold value for the confidence score. If the returned
value is less than the threshold value, then a fallback intent will be
triggered or, if there is no fallback intents defined, no intent will
be triggered.
You can see the score for your query in the JSON response:
{
"source": "agent",
"resolvedQuery": "Which city does he live at?",
"metadata": {
"intentId": "...",
"intentName": "Location_context"
},
"fulfillment": {
"speech": "Your uncle is living in New York",
"messages": [{
"type": 0,
"speech": "Your uncle is living in New York"
}]
},
"score": 0.9
}
Compare the scores between the right and wrong matches and you will have a good idea of which confident score is the right one for your agent.
After changing this settings, let it train, try again, and adjust it until it meets your needs.
Update
For queries that still will get a high score, like Where is he cooking?, you could add another intent, custom fallback, to handle those false positives, maybe with a custom entity: NonLocationActions, and use the template mode (#) in user expressions.
where is he #NonLocationActions:NonLocationActions
which city does he #NonLocationActions:NonLocationActions
So these queries will get 1 score in the new custom fallback, instead of getting 0.7 in the location intent.
I am working on a chatbot using dialogflow and am getting similar problems.
Our test manager invented the 'Sausage Test' where she replaces certain words in the question with the word sausage and our bot fell apart! Even with a threshold of 0.8 we still regularly hit issues where intents fire for nonsensical sentences, and with an enterprise level chatbot that is giving out product installation advice we could not afford to get it this wrong.
We found that in some cases we were getting max confidence levels (1) for clearly dodgy 'sausaged' input.
The way we have got round this issue is to back all the answers onto an API and use the confidence score in conjunction with other tests. For example we have introduced Regular Expression tests to check for keywords in the question, together with parameter matching (making sure that key entity parameters were also being passed through in the data from DialogFlow).
More recently we have also started to include in the reply a Low Confidence sentence at the start of the reply i.e. 'I think you are asking about XYZ, but if not please rephrase your question. Here is your answer'. We do this when all our extra tests fail and we have a threshold between 0.8 and 0.98.

Resources