Dialogflow confusing intents - dialogflow-es

I am creating a basic application using dialog flow and noticed that it keeps confusing the intents. I have 2 intents, one for buying a car and one for buying a bike.
The car intent has training phrases (Action: buyCar):
I would like to buy a car with 4 doors
I would like to buy a car with 2 doors
The car should have 4 doors
The bike intent has training phrases (Action: buyBike):
I would like to buy a bike with 400 hp and red color
the bike should have 350 hp and green color
I assumed the intents would match based on the type of vehicle (car or bike) and specifically related to the sys.num + doors (as defined in my car entity) for cars and sys.num + hp and sys.color for bikes (as defined in my entities). However when I actually ask it something about a bike.. it takes on the car intent (as it was defined first?)
for instance, if I ask the simulator I would like to buy a bike with 400 hp and red color It would assign the action as buyCar and assign the vehicle as bike, however since it thinks the action is car, it assigns the sys.num + doors as 400 hp.
I cannot seem to figure out how to stop it from getting confused.. I realise intents are matched based vaguely on keywords, but is it possible to specifically match only on these keywords and based on the number of variables required? so 1 var would be car, 2 vars would be bike.

Related

How to express counter type entity with UML?

I would need some help with a problem we're facing in a company, trying to model every process and entity.
So far we have used an enhanced conceptual model with entities and attributes with relationships but there are some objects that don't exactly match a dimension or a fact table, and this is an entity that can be called "Shops with sales over X units". There is the entity "sales" and "shop" obviously, that would have it's representation in UML as independent entities and represent at the lower level, each sale and shop.
What we need to indicate in UML is an entity that stores the counter of shops with sales over X units, so this has some kind of behavior or conditions.
If we consider the entity, it would need date-from and date-to, and the value (counter), and creating a connection with the shop entity seems enough, but we miss the behavior that expresses "more than x sales". So the behavior could be for example: Go to the shop entity, take the 1st element and navigate to the sales entity, calculating the sales. If it's over X, then value+1, and so on.
I made a simple version of the problem. Blue boxes represent the entities already created, and the orange one is the counter that should count the shops with some constraints.
Is there any way of using some kind of UML diagram that can help us to solve this problem?
You could realize that with an association class:
ShopSales relates Shop and Sales so you can store the number of sales along with other things you might need in that conjunction. The ShopSalesStats could give you the shops by number of sales.
Another (of many) way(s) would be to just hold the count as public property of Shop and let ShopSalesStates handle the counts on all associated Shops.

Should entity be specific to Intent of Dialogflow?

For example Intent cutoff has training phrase - ABC college cutoff
where ABC college is entity - college
cutoff is - collegedetail entity
Now another Intent exam has training phrase - ABC college exams
where ABC college is again entity - college
exams is again- collegedetail entity
Here entities are meant to be same but Intents are different. But Dialogflow is confusing the intents every time because of same entities.
So my question is should entities be Intent specific or there is some other way to handle this situation?
Parameters for the training phrases are meant to capture different values, all of which are valid for that Intent.
If the Exam intent has a training phrase "[ABC college][exams]" with each of those parts having an Entity, then it means that you're expecting different values for each part, the Entity reflects what those possible values should be, and you want to be able to find out what that specific value was.
It sounds like you're saying that the training phrase for the Exam Intent should be something more like "[ABC college] exams". So you have a parameter for the college being asked about, but you are expecting only "exams" to be a valid thing said for this Intent. You don't need to know exactly what that value was - you know its about exams because that's the purpose of all the training phrases for that Intent.

Three part related entities not specifically identified by a sentence

How do I train a Watson Knowledge Studio machine learning annotator to identify education info that is not a part of a proper sentence. For example, two bullet points. How do I form a type system that will identify entities without breaking them all apart? I've considered using relation annotations, but according to the official documentation relation types should only be annotated if the sentence specifically mentions the relation. Such as "Mary works for IBM" is an example of the employedBy relation type. (Mary employedBy IBM) However, their own videos show them annotating "Ford F-150" with a manufacturedBy relation even though the sentence doesn't specifically state the relation. For example, "The Ford F-150 struck a light pole." (F-150 manufacturedBy Ford)
This is the kind of text I'm working with:
B.A., City University of New York, 1995
M.A., New York University, 1997
Ph.D, Columbia University, 1999
I could annotate these with degree, school, and graduationYear entities, but I'll end up getting back "1995", "1997", "1999" "B.A.", "City University of New York", "Columbia University", "M.A.", "New York University", "Ph.D"; a jumble that I can't work with because I can't tell anymore what degree belongs with what school belongs with what graduation year.
As for the expressions which include two bullet points, there is a possibility to improve accuracy to detect sentences as they can work with WKS, using Dictionary-based Tokenizer.
https://console.bluemix.net/docs/services/knowledge-studio/create-project.html#wks_tokenizer
I imported your example text to WKS and checked the result of tokenization, and then the expression was separated into 3 sentences.
In this case you can annotate relations among degree, school and graduation year.

Could I define entity type automatically?

I am trying to develop software to get suitable attributes for entities names depending on entity type.
For example if I have entities such doctor, nurse, employee , customer, patient , lecturer , donor, user, developer, designer, driver, passenger and technician, they all will have attributes such as name, sex, date of birth , email address, home address and telephone number because all of them are people.
Second example word such as university, college, hospital, hotel and supermarket can share attributes such as name, address and telephone number because all of them could be organization.
Are there any Natural Language Processing tools and software could help me to achieve my goal.
I need to identify entity type as person or origination then I attached suitable attributes according to the entity type?
I have looked at Name Entity Recognition (NER) tool such as Stanford Name Entity recognizer which can extract Entity such as Person, Location, Organization, Money, time, Date and Percent But it was not really useful.
I can do it by building my own gazetteer however I do not prefer to go to this option unless I failed to do it automatically.
Any helps, suggestions and ideas will be appreciated.
If I understand correctly, you are mainly interested in knowing if a given word can be mapped to a general category of Human, Organization, etc.
You should use WordNet, which provides a complete hierarchy of the general English lexicon. Try it a bit in the user interface to get of feel of how it works.
WordNet encodes relations between words. One of these relation is hypernymy, a fancy word that means a relation of general-to-particular.
Some examples:
Vehicle is a hypernym of boat.
Vehicle is a hypernem of car.
Human is a hypernym of worker which is a hypernym of plumber.
Hyponymy is the inverse relation of hypernymy:
Boat is a hyponym of vehicle.
Car is a hyponym of vehicle.
Plumber is a hyponym of worker, itself a hyponym of human.
These relations are transitive, so in my last example plumber is also a hyponym of human. This gives you the solution to your problem: any word that has human as hypernym should be mapped to Human and have people attributes.
There are libraries to access WordNet from Java and Python, as well as from many other languages. Here is the documentation for using WordNet with the NLTK Python module.
A short example to determine if a word is hyponym of "human"
from nltk.corpus import wordnet as wn
human = wn.synset('person.n.01')
hyponyms_of_human = set(x for x in human.closure(lambda s:s.hyponyms())
fireman = wn.synsets('fireman')
salad = wn.synsets('salad')
print(any(x in hyponyms_of_human for x in fireman)) # outputs True
print(any(x in hyponyms_of_human for x in salad)) # outputs False

Where i need to position fill application form in swimlane !

I am writting a sequence diagram where custome fill a application from for a bank
here i have two swim lane ..one is customer and another is bank
in which position i need to position "fill application form" activity?
Should it be in customer swim lane or in bank swim lane
since the customer is filling application so shouldn't it be for customer swim lane?
but customer is filling banks application form so shouldn't it be for bank swim lane?
You are confused.
There is no swimlane in sequence
diagram. Swimlanes are in Activity
diagram.
If you try to model a business process using sequence diagram this is wrong. Sequence diagrams are for exploring real software objects interactions.

Resources