I'm new to Dialogflow and want to make a demo with sports results, stats, etc.
My problem is with disambiguation, for instance
What was the result of Manchester against Liverpool?
Manchester could mean M. United or M. City so I have to ask the user which one is he referring to.
What is the quickest way to do this? Please note that there are a lot of intents (20+) that need this disambiguation so a one-off solution would be great.
Thanks in advance!
Related
I'm new to NLP.
I want to extract music artist's name from plain text like that is posted on social media.
The text looks like this. (this is just sample, not real)
Today bandcamp is waiving fees again! CHANGE, TAYLOR SWIFT and POP
SMOKE will be using all funds collected through bandcamp to donate to
Anti Repression Committee. No Justice No Peace.
This time,I want to extract string "CHANGE","TAYLOR SWIFT","POP SMOKE".
I already tried NLTK and spaCy but it didn't work as desired.
Is there any other idea how I can achieve this?
Thanks in advance.
If you have a lot of upper case data like in your example, you might want to pass the data through a truecaser first. There’s one available in the Stanford NLP package. After that, spacy might have a better shot at picking the names out. On this text:
Today bandcamp is waiving fees again! Change, Taylor Swift, and Pop Smoke will be using all funds collected through bandcamp to donate to Anti Repression Committee. No Justice No Peace.
en_core_web_sm will pick out Taylor Swift and Pop Smoke as entities. Change / CHANGE is going to be tough for any model to pick out.
For instance, I've created two Intents on Dialogflow, A and B:
A - Question: It's going to rain? -> Answer: yes, it is.
B - Question: what is the color of the sky ? -> Answer: blue
If I ask separately A or B, the answer it's right, but if I ask: "It's going to rain and what is the color of the sky?" It's just answer one of the questions.
It's there a way where the dialogflow can understand the two intents?
Thanks.
Currently, this feature is not present in the dialogflow (or any NLP engine i guess). Dialogflow takes an input sentence and maps it to an intent based on confidence score.
Even if you the NLP engine gives you confidence score of all the intents, you would have problem in combining them.
One solution could be making an intent C which would contain such training phrases, but that would require thorough planning about what users might ask, and what intents should be grouped together to make new intents.
I am working on an NLP Chatbot project. The Chatbot will need to process requests like the following:
"I want to go to Penn Station from Back Bay Station" and "I want to go from Back Bay Station to Penn Station"
In each case, I want to extract the source train station as "Back Bay Station" and the destination as "Penn Station." However, because of the sentence re-ordering, I am not sure how to do this.
Any advice, including examples, would be much appreciated.
Two ways.
Heuristics: Look for words like 'to' and 'from' and similar before the entities. You might have to spend some time creating a library of these prepositions or subordinating conjunctions but that will do the job.
Use more sophisticated deep parsers that can do this job for you. You might have to still fall back to heuristics here as well, but you can get much more information this way. I am suggesting this option because I don't know how wide your problem statement is. If it is just about 'to' and 'from' then stick to option 1
I am using "list" entity. However, I do not achieve my expected result.
Here is what I have for LUIS intent:
getAnimal
I want to get a cat**[animal]**.
Here is what I have with LUIS entities:
List Entities [animal]
cat: russian blue, persian cat, british shorthair
dog: bulldog, german shepard, beagle
rabbit: holland lop, american fuzzy lop, florida white
Here is what I have with LUIS Phrase lists:
Phrase lists [animal_phrase]
cat, russian blue, persian cat, british shorthair, dog, bulldog, german shepard, beagle, etc
Desired:
When user enters "I want to get a beagle." It will be match with "getAnimal" intent.
Actual:
When user enters "I want to get a beagle." It will be match with "None" intent.
Please help. Your help will be appreciated.
So using a phrase list is a good way to start, however you need to make sure you provide enough data for LUIS to be able to learn the intents as well as the entities separate from the phrase list. Most likely you need to add more utterances.
Additionally, if your end goal is to have LUIS recognize the getAnimal intent, I would do away with the list entity, and instead use a simple entity to take advantage of LUIS's machine learning, and do so in combination with a phrase list to boost the signal to what an animal may look like.
As the documentation on phrase lists states,
Features help LUIS recognize both intents and entities, but features
are not intents or entities themselves. Instead, features might
provide examples of related terms.
--Features, in machine learning, being a distinguishing trait or attribute of data that your system observes, and what you add to a group/class when using a phrase list
Start by
1. Creating a simple entity called Animal
2. Add more utterances to your getAnimal intent.
Following best practices outlined here, you should include at least 15 utterances per intent. Make sure to include plenty of examples of the Animal entity.
3. Be mindful to include variation in your utterances that are valuable to LUIS's learning (different word order, tense, grammatical correctness, length of utterance and entities themselves). Highly recommend reading this StackOverflow answer I wrote on how to build your app properly get accurate entity detection if you want more elaboration.
above blue highlighted words are tokens labeled to the simple Animal entity
3. Use a phrase list.
Be sure to include values that are not just 1 word long, but 2, 3, and 4 words long in length, as different animal names may possibly be that long in length (e.g. cavalier king charles spaniel, irish setter, english springer spaniel, etc.) I also included 40 animal breed names. Don't be shy about adding Related Values suggested to you into your phrase list.
After training your app to update it with your changes, prosper!
Below "I want a beagle" reaches the proper intent. LUIS will even be able to detect animals that were not entered in the app in entity extraction.
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.