Extract Array of Values for Watson Dialog Variables - ibm-watson

In DevPost Watson Developer Challenge for Conversational Applications post, I saw Watson (maybe) able to analyze following phrase "I want to visit Tokyo, Sydney, Manchester, and Reykjavik during a trip that takes 30 days".
Is there a better way to extract those array of locations without having to predefine max no of location variables (i.e. set location1 - 5) and manually specify various grammar items like $ (Locations)={location1} * (Locations)={location2} * (Locations)={location3} * (Locations)={location4} as per Pizza example dialog? I would like to follow up with comment such as "That's a lot" if location > 4, or "Sure" if less.

You could try something like alchemy or relationship extraction to identify all of the languages, and then simply add them to the user profile in Dialog. But today, the best way to do this within a broader conversation will be to do it the same way the pizza sample does as you outlined above.

Related

Can I use AMPScript in the Picklist Options available in Distributed Marketing Multivariate to choose between a list of sentence/code options

For example the variable name %%=(#variableName)=%% would be used to select other variable name %%=(#anotherVariableName)=%% from the Options in the Distributed Marketing Multivariate. This AmpScript "%%=(#anotherVariableName)=%%" would then trigger a sentence or code snippet in the body of the email.
Ultimately, Im looking for ways that a Sales User in Salesforce Lightening can choose from a predetermined list of sentences and code blocks to build an email when using Quick Send. If there are any suggestions or examples anywhere I would be enternally grateful.

How can I get Watson to recognize two different dates upon user input?

If a user asks the following sentence:
For some reason Watson uses the first date for the both $checkin and $checkout variables even though it detects the second date.
You can refer to the "dialog node" screenshot to see how the nodes are setup.
How can I get Watson to recognize the first date is the checkin date and the second one is the checkout date. Is there a way I could tell Watson after the first date is used if a second one is detected use it to fill the next slot?
I've found something about the #sys-date range_link entity. But the documentation is not detailed.
This is easy to do, but comes with issues you need to be aware of.
Slots allows you to define variables as they are read. For example.
Will generate this:
The issue is that you are assuming that people will ask in the same order that you need the information. If this doesn't happen then this will fail.
You can mitigate this by shaping how the user may ask the question. For example:
"Please let me know where you are leaving and going to"
The person is more likely to respond with the exit date first.
BETA
This is likely to change and doesn't fully work as you expect. You can enable the beta #sys-date in the options. So I wouldn't recommend relying on this until it is final.
You first need to check for range_link. This will tell you if it detected that two dates are connected to each other.
Then you can do the following:
From Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_from'")[0]?.value ?>
To Date: <? entities['sys-date'].filter("d", "d.role.type == 'date_to'")[0]?.value ?>
What this does is find the exact record that has the role of date_from and returns the value. Likewise for date_to.
You end up with something like this.

Using Watson as a testing tool

I'm wondering about using Watson assistant as a simple tool for informal testing of medical students. I'm a bit confused as to whether this is an appropriate use. I have played around but am quite stuck.
I have a symptom X in mind, that, if the user asks about, Watson would spit out 3 questions sequentially, and test the users responses against some specific terms.
These questions look like
1. how much water does a 'symptom X' patient drink ?
Watson would take their input and compare it against definition somehow
what are the 3 diseases that can manifest with 'symptom X' ?
Watson would then take their input and compare it against the known list
what tests should be run immediately on a patient presenting with 'symptom X' ?
Watson would then compare their input to known list
Am I way off base with how I am using trying to use it?
-So far I have set up
intent = test_me (eg Can you test me)
#entity = symptom X
My first dialog node is if #test_me and #symptom X ->
'Sure, I can test you on symptom X'. I'm going to ask you 3 questions on this.
Pause.
Response -> how much water does a 'symptom X' patient drink ?
Their response would be along the lines of 'more than 100ml/kg/day'
How can I evaluate this response?
Is what I'm trying to do beyond the scope of a chatbot / WA?
The simple way would be by adding NLU (Natural Language Understanding) to the solution. If the language is English, NLU by default would get the 100ml as a Quantity and you can also use the syntax enchantment, if you need to apply a different rule when the user writes things like "more".
If there are more complexity to the sentences and NLU by default is not enough, you can train a custom model using WKS (Watson Knowledge Studio) and use it with NLU. The same applies for languages where the default model doesn't give you enough info.
NLU also have some understand of a good number of medical terms, that seems to be of use for your solution.
If you need to do it using only Watson Assistant, the only solution I can imagine is to use regex to get the number and the type (ml/day/km/etc). Something like "(\d+)(\w{2})"

how can I create .csv file for watson Natural Language Classifier

My .csv format is like this
Good evening,Greeting
good morning,Greeting
good afternoon,Greeting
hi everybody,Greeting
1,quantity
2,quantity
3,quantity
4,quantity
5,quantity
I would like you to give me *,OrderPlacement
I need *,OrderPlacement
I needed *,OrderPlacement
Please send *,OrderPlacement
Now input text is I need 3 pens then NLC set higher confidence to quantity. So how can I resolve this error?
There are a number of issues.
The purpose of NLC is to train off questions in a natural language format. Using those questions, it is able to determine the intent of a question it is never seen before.
Because of this, your training data has to be proper English. These lines will not work:
1,quantity
2,quantity
3,quantity
4,quantity
5,quantity
Instead it should be in a way that someone may ask, and not all the same pattern. For example:
I would like to buy 1 item,quantity
Can I get 2 items?, quantity
Please add three items to my basket, quantity
I want to purchase four boxes of your product, quantity
Please send me five boxes, quantity
Even then I would recommend not to manufacture questions. As you are training it on how you speak, and not your end user.
Also as #Leo mentioned, NLC is not a parser. So these lines will not work:
I would like you to give me *,OrderPlacement
I need *,OrderPlacement
I needed *,OrderPlacement
Please send *,OrderPlacement
Because they are incomplete sentences. You have lost the intent of the original question.
Lastly NLC requires a minimum of 5 questions per intent to correctly train.
You can read more details on how it works in the service API document.

Searching through descriptions

There's a movie which name I can't remember. It's about a carnival or amusement park with a horror house and a bunch of teens who are murdered one by one by something with a clowns mask. I've seen this movie about 20 years ago, and it's sequel, but can't remember it exactly. (And also forgot it's title.) As a result, I started wondering about how to solve something technical.
Assume that I have a database with the story plot and other data of each and every movie published. (Something like the IMDb.) And I would have an edit field where a user can just enter a description in plain text. The system would then start analysing this text to find the movie(s) that would qualify to this description.
For example (different movie), I enter this in the edit field: "Some movie about an Egyptian king who attacks a bunch of indians on horseback, but he's badly wounded and his horse dies while he lost this battle."
The system should then report the movie "Alexander" from 2004 as answer, but possibly a few more. (Even allowing a few errors in the description.)
To create such a system where a description gets analysed to find a matching record by searching through descriptions, what techniques should I need for something as complex as that? Not that I want to build something like that right now, but more out of curiosity if I ever want to pick up some interesting new project.
(I wanted to award extra points for those who recognise the movie I've mentioned in the beginning. But one Google-attempt later and I found it myself!)
Btw, it's not the search engine itself that interests me, but analysing the description to get to something a search engine will understand! With the example movie, it's human logic that helped me to find the title. (And it's annoying that this movie isn't for sale in the Netherlands.) Human logic will always be a requirement but it's about analysing the user input, which is in the form of a story or description, with possible errors.
You should check out document classification.
A few document classification techniques
Naive Bayes classifier
tf–idf
For what I can tell by your own comments, Google is the technique to be used. ;-) But, honestly, I think more or less any search engine would do.
Edit: heh, you removed your comment, but I do remember you mentioned Google as the one deserving extra points.
Edit+: well, you mentioned Google again, but I don't want to remove my first edit. ;-)
Pure speculation: Would something trivial such as taking every word of more than 4 letters in the description "Egyptian, Indian, horse battle etc." and fuzzy matching against a database of such summaries work? Perhaps with some normalisation eg. king == leader == emperor?
Hmmm ... Young Man, Girlfriend, swimming pool, mother, wedding does that get us to The Graduate? Well I guess with a small amount of specifics "Robinson" it might.
You can do lots of interesting stuff with the imdb keyword search:
http://akas.imdb.com/keyword/carnival/clown/murder/
You can specify multiple keywords, it suggests movies and more keywords which are in similar context with your given keywords.
The data contained in imdb is publicy available for non-commercial use and can be downloaded as text files. You could build a database from it.

Resources