Getting the user's name without directly asking for it (Watson Assistant) - chatbot

I'm creating a chatbot for fun and want to implement something to collect the user's name, but only if he says something like "my name is ..." or close to that; the intention of giving the name would come from the user, the bot won't ask for it, maybe only suggest it. Kind of like in Google Assistant, I think. So, it could be given at any time the user wants.
My idea is:
1st create an intent with different ways the user would tell his name to the bot (like in the example above).
2nd use slots and, if the intent is detected, save it as a variable. So far, I've managed.
3rd is the part that I'm stuck in, since it's only an idea and I don't know how I'd do it. Before saving the whole text as a variable, I'd like to delete the part that's included in the intent (my name is) and save only the rest in the variable. So, for example, the user says "my name is XXX"; the command deletes the "my name is" part and saves only "XXX" in the $name intent.
I don't know if this'd be possible, since I don't know coding. I used some special syntax before, like to capitalize the first letter of some other variable, but I don't really know how to use the JSON editor.
Is my idea viable? I don't know how I'd delete the intent corresponding portion and save only the remaining part as the intent. Dunno what would be the command for that, nor where I'd write it.
You can suggest something else if you have an idea.
Last thing, I'm created the skill in portuguese, so there's no access to the #sys-person entity.
Thanks for reading.

I use portuguese skills and face the same issue. I see two solutions, althougt they are not perfect:
Using intents:
When the intent is identified, the bot asks the name again, telling the user that he should only say his name, e.g without "my name is", then store the whole input on a context variable, using:
<? input.text ?>
For embedding such logic inside slots, you probaly will need to use digressions.
But, this is boring to the user.
Using entities:
Entities identification carries along they start and end position in the input text, but intents not. With this, is possible to slice the input, cutting the entity:
<? input.text.substring(entities.name.location[1], input.text.length()) ?>
Entites would be "My name is", "People call me", "I'm called", "I'm baptized", "I was baptized".
So, "Hello, my name is Gustavo", would be cut after "my name is" ending, resulting in "Gustavo". Additional input in the beggining is ignored, but problems arrise with additional input after the name. Also, you need to define more "my name is" like entities, likely all possibilities, than would need if using intents, cause even with fuzzy matching, entities identification doesn't take in account synonymus and similar meaning words.
https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-strings-substring
https://cloud.ibm.com/docs/assistant?topic=assistant-expression-language#expression-language-access-entity

Related

RegEx for google event

Hello I would like help writing a regex that captures all urls with the word confirmation in it.
Ex:
https://example.com/this-is-a-confirmation
https://example.com/confirmation
https://example.com/folder/this-is-confirmation
I am trying to set up a Goal that captures all visits to any confirmation page on the website as by visiting that page you most likely filled out a form to download an asset
Thanks!
So, basically all links end with confirmation?
Then you could just use a very stupid and simple regex like:
confirmation$
If you only want the URL to contain confirmation:
confirmation
is already enough (Demo). That's basically the same as if you were using String.endsWith(str) and String.contains(str).
Depending on the way you're evaluating this, you may need to allow chars before the search term to produce a full match (not only a partial match):
.*confirmation
or
.*confirmation.*
if you want to allow any text after the search term.

How do i stop my Watson Assistant from auto-correcting the user input

Can anyone help me solve this issue
The screenshot attached below is self explanatory
It is auto-correcting sufyan to Susan
The value for the context variable is
"<? input.text.substring(0, 1).toUpperCase() + input.text.substring(1) ?>"
The motive here is to simply convert lowercase name sufyan to Sufyan
or for that case any Indian name.
But the auto-correct has now become a hindrance.
I want the assistant to interact with the user in the later part using his/her name.
You can configure autocorrection in your bot settings.
Along with Henrik’s answer, it’s good to learn about fuzzy matching in Watson Assistant as it runs before autocorrection
How is spelling autocorrection related to fuzzy matching?
Fuzzy matching helps your assistant recognize dictionary-based entity mentions in user input. It uses a dictionary lookup approach to match a word from the user input to an existing entity value or synonym in the skill's training data. For example, if the user enters boook, and your training data contains a #reading_material entity with a book value, then fuzzy matching recognizes that the two terms (boook and book) mean the same thing.
When you enable both autocorrection and fuzzy matching, the fuzzy matching function runs before autocorrection is triggered. If it finds a term that it can match to an existing dictionary entity value or synonym, it adds the term to the list of words that belong to the skill, and does not correct it.
Check the complete documentation here before turning of autocorrection
You can use the following context variable:
"<? input.original_text.substring(0,1).toUpperCase() + input.original_text.substring(1) ?>"

issue with DLOOKUP syntax error for new database

I have a database with 4 tables but primarily it is a diversion table/form (DiversionT/F) and a payback table/form (PaybackT/F). Basically, when my program loans parts to other programs in my organization a diversion is created in DiversionT. When the program want to payback they create a payback entry in PaybackT.
I have an issue that I am confused about: On PaybackF the user enters an NSN (long part code) that they want to payback. Ultimately, I want some of the form to auto populate with part info based on the NSN entered. The info is stored in DiversionT. I have created a few text boxes on PaybackF to show the info. The first text box I am trying to autofill based on the NSN is a textbox called PartName. It should search DiversionT for that NSN and fill in the appropriate PartName on PaybackF. In the control Source for the box I typed:
=DLookUp("[PartName]","[DiversionT]", "[PartName]=" & Forms![PaybackF]!NSN)
I get the following error:
The expression you entered contains invalid syntax.
To be perfectly honest I don't really understand VBA yet (spent my life until now with C, C++, Java, and Python) but looked up the function on the Microsoft site.
If I am not going about this right, please also let me know?
When using DLookup to get data, if you are dealing with text strings, you need to ensure that you use single quotes to wrap the text in.
Also, I think that your logic in the DLookup is slightly wrong. I think that this is what you are after:
=DLookUp("[PartName]","[DiversionT]", "[NSN]='" & Me!NSN & "'")
Regards,
You can't enter VBA in to form properties like source control. VBA is only used in procedural code in the VBE. That being said, there is a DLOOKUP function available to form fields and the syntax is similar. This is a cause of your confusion.
EXAMPLE SYNTAX FOR NUMBERS:
=DLookUp("[PartName]","DiversionT", "[PartName]=" & [NSN])
EXAMPLE SYNTAX FOR STRINGS:
=DLookUp("[PartName]","DiversionT", "[PartName]='" & [NSN] & "'")
NOTE:
I can't tell what form you are on or if NSN is from a parent form or subform. Basically, NSN needs to be readable from the same form where that text field exists.

Is it possible to use INTENT instead of STRING as List Title in Google Action?

Some Background:
I use Lists a lot for a Google Action with a NodeJS fulfillment backend. The Action is primarily Voice-based. The reason for using List is that I can encode information in List's key and use it later to make a decision. Another reason is that Google Assistant will try to fuzzy match the user's input with the Title of the List's items to find the closest matched option. This is where thing's get a bit hard for me. Consider the following example:
{
JSON.stringify(SOME_OBJECT): {
title: 'Yes'
},
JSON.stringify(ANOTHER_OBJECT): {
title: 'No'
}
}
Now if I say Yes / No, I can get the user's choice and do something with information stored as stringified JSON in the choice's Key.
But, the users may say Sure or Yup or OK as they basically mean the same thing as saying Yes. But as those words don't match Yes, Google Assistant will ignore the "Yes" option. But all of these words belong to the smalltalk.confirmation.yes built-in intent. So, if I could use this intent instead of hardcoding the string Yes then I would be able to capture all of the inputs that mean Yes.
I know I could do this with a Synonyms list or Confirmation intent. But they also have some problems.
Using Synonyms would require me finding every word which is similar. Besides, I would also need to localize these synonyms to all the supported language.
With Confirmation intent, I won't be able to show some information to the user before asking them to choose an option. Besides, it also doesn't support encoding the options as I can do in List's key.
So, List is a good choice for me in this case.
So, is there any way to leverage the built-in intents for this purpose? What do you do in this situation?

Using context variables to write the user's car registration

In watson-conversation, I have reached a point where I ask the user their car number (registration), which follows this format: 0000BBB (4 numbers, 3 letters).
I want to type that to the user like:
User: "My car id is 0123asd"
Watson: "Okay so your car id is this one: 0123asd"!
I have tried defining an entity #carId with some examples, but every time I input something with that format (0000BBB), it shows "irrelevant".
If the chat detects #carId, respond with Okay so this is your carId! #exampleCarId (I have some examples like 5487qwe, or 8521rty, I thought the machine learning below that would learn the "pattern").
And my #carId has these examples:
I know I am missing something! Do I need to code anything? I think it's not necessary. I tried to save it on a sys-number but it does not work as it is not a "number".
Most developers would consider he car ID an entity (denoted by #). IBM Watson Assistant allows to define so-called dictionary-based entities. One form of such an entity is pattern-based. Thus, you would define a pattern of 4 digits and 3 letters.
You could have an intent (denoted by #) that identifies that a user inputs the car ID. In the dialog node you could match against the intent and then assign the matched entity for the actual ID to a variable.
The linked documentation has examples.