IBM Watson Slots won't accept 0 - ibm-watson

I'm trying out the slots feature in IBM Watson Conversations and have hit an issue which I'm not sure how to work around.
I have a use case that is collecting a number of pieces of information from a user so using the Slots feature makes sense. Unfortunately when I add a Slot with #sys-number the system will not accept 0 as a valid input. This slot is in fact required but 0 is a valid value.
Anyone have an idea of how to have a required Slot of type #sys-number that accepts 0 as a value?

The condition #sys-number is in fact a short hand syntax for condition entities['sys-number'].value. When 0 is sent the condition is evaluated to false as 0 is treated as a false by the expression language evaluator in Watson Conversation Service. Now this is not a desired behavior in this case. To prevent this for happening one can use entities['sys-number'] in the condition that will return true every time #sys-number entity is recognized in the input.
When using this in slot one might want to edit what gets stored in the context variable as changing the condition will also change what is stored in the variable. This can be done by a JSON editor - click configure slot gear next to the slot specification and in the window that opens click three dots, open JSON editor and there change what gets actually stored inside the context variable that gets updated by the slot.
Here is a link to system entity section in Watson Conversation Service documentation.

I had a similar problem with recognising zero values in slots and the system entity documentation did not explain it well enough (for me at least).
Further elaborating on Michal's answer above:
Click the "Edit Slot" option (gear icon)
Set the "Check For" attribute on a slot condition as entities['sys-number']
Click the edit slot modal menu options (three bubbles in corner)
Open the JSON editor
Change the context variable value to "<?entities['sys-number'].value ?>"
Result:

Related

Send checkbox to range from single checkbox incrementally in Google Sheets

I have a Google Sheet with a large number of applications with multiple responses. The person going through them would like all of the information for each application formatted neatly and to give them a way to go through each application and mark whether to accept or reject the entry.
I have set up and formatted a sheet that displays all of the info from a single application with all of the answers being displayed by =Indirect() referencing a hidden value. A simple next button attached to a script increases that value by 1 to bring up the next application.
I need a way to send the Accept/Reject value back to the first sheets raw data, but it seems like checkboxes only work with formulas when they are receiving a value. Because the same cell is being used when parsing through applications, I have no way of referencing that checkbox in the raw data.
I think I need to have a script check the indirect value to know which application is currently being used and then send TRUE to the correct cell, then have it be reset back to unchecked (potentially as part of the 'Next' button)?
Hopefully I explained this well enough and thanks for any help~

Watson Assistant -- Prompting for required slot not working

I have this node on the dialog tree of my Watson Assistant
So this node should be triggered when an entity #courses with either the value course or math is found.
In case the value of the entity courses is course but not math then the slot still needs to be filled and should prompt the user with 'Which specific course are you referring to?' since the slot is required. The problem I'm having is that the prompt is not getting triggered as shown in this image
So the entity courses with the value course is correctly identified but the prompt is not triggered.w
Am I missing something?
Edit
So modifying the configuration of the slot to add conditional responses I added a conditional response if the value of #courses:math is not found. Notice that I'm checking for the value of #courses:math on the black marked area but then I check on the conditional response if it is not found (red area) and if the value #courses:course is found and then the response should be triggered. So the conditional response should be something like
if #courses:course exists and #courses:math doesn't exist then
print "What specific course are you referring to?"
else if (#courses:course exists and #courses:math exists) or #courses:math exists then
do something else
But this is still not triggering any response for me.
You will need to configure the slot further.
Click the cog out to the side (between required and the trash can). You should see a modal appear that looks similar to the screen shot below. Click the dot dot dot menu at the top and click "Enable Conditional Responses". This will change the modal a bit so you can check the value of the entity. In the screenshot you can see I tested it, and the behavior appears to be what you are looking for.

Conversation - using entities values/size as a condition

I'd like to know how to use the values from the entity as a IF bot recognizes
condition on Watson Conversation.
I have one menu for the users choose one option. And all of these options are inside one Entity called #optionsNumbers with the values: 1, 2, 3, 4, 5.
And I want to make one condition that will verify if user chooses more than one option.
E.g:
Watson: Hello, welcome to the Official Virtual Assistant from the Company XX. You can choose this options above:
1. About products 2. About Services 3. Exit
User: I want the option 1 and 2
So, the entity #sys-number have 2 values, and not just one, like I need.
As you can see, the user types 2 values of the entity #option. And I'd like to know how to recognize if the user typed more than one value for this particular entity, also #sys-number, cause the user can type just ONE option (business rules).
I'm enthusiast about Watson and pretty sure I read all documentation. So, what I have tried and does not work (I saw these methods with Intents examples):
if bot recognizes entities.sys-number[1].value
if bot recognizes entities['sys-number'].size > 1
And I know that I can create two conditions, but if my Options menu have more than 20 options? That's why my asking.
First, you could use the system number entity built-in type provided by Watson :
Entities > System Entities > Enable System Number
Your intent should now be able to recognize it easily by default, let's check the following intent :
And you test it with the sandbox, it works as expected
EDIT: Using Dialog to add a condition on sys-number
Create new dialog node for matching the intent :
Then enable the Multiple Responses for this node ( click Customize ) :
Add your conditions as part of the responses :
Then test your dialog :

How to create a Drupal rule to check (on cron) a date field and if passed set field "status" to "ended"?

I'm trying to create a custom rule (using the Rules module) so that every time the cron runs, this rule checks a date field in a custom content type I created. If that date has passed then I want to set a list widget from active to ended.
This is how far I get when trying to create this rule:
Set React on event to Cron maintenance tasks are performed
Add Condition > Set Select the condition to add to Data comparison > Continue
Here is the issue: Data selectors only has site and no access to field data.
Any ideas where I'm going wrong here?
The problem with Rules condition "Cron maintenance tasks are performed" is that at that point, there is no access to the node object so any checks/manipulations on the node are not possible. As a solution, instead of Event = Cron maintenance tasks are performed, use Event = Node: Content is viewed. You can leave it open for any content type so that when someone visits the website and opens at least one page, some action will be triggered.
You need to create a rules component first:
Go to Rules > Components (admin/config/workflow/rules/components)
Then create a new component and select 'Rule' from select list
Set a name for this component and in the table below select:
Data type: Text Token
Label: A name that you want
Machine name: Use the same name of the label but set here only lower case and underscore
Usage: Parameter
In the component add the condition 'Data comparison' and select node:type
Add other conditions that you want
Set the actions that you want and save
Now go to Rules (admin/config/workflow/rules) and create the rule with action on cron maintenance (as you have already done)
Jump the conditions section and in the actions:
New action: Add a variable
Value: Text
Then write the value of this variable just like the machine name of content type that you want to cycle on (if you want you can change the name and machine name of this variable in the section below)
Now add another action 'Fetch entity by property'
Entity type value: Node
Property value: Type
Data selector: the variable created at the point 8
Now add a loop in parameter list use the variable provided by 'Fetch entity by property'
Add an action in the loop (click on the link to the right of loop row) and select the component created in the point 2 and pass the variable provided by loop
I state: I do not know if it works but at least it should direct you towards the right path
Sorry for my english, I hope you understand everything :)
Yes you should be able to get this to work using the Rules module to implement what you're looking for, but I recommend you to also combine that with the Views Rules module. Some details about this module (from its project page):
Provides Views directly as Rules actions and loops to seamlessly use view result data.
The previous quote may seem a bit cryptic (it may make you think like "so what, how can this help me?"). Therefor some more details about how to move forward using these modules:
Create a view (using Views) so that you have 1 Views result (row) with all the nodes you want to be processed (related to your custom content type and if possible filter somehow using your date field). Whereas that view has fields (columns) for whatever is needed in subsequent steps, e.g the node ID, the date field, and possibly other fields as well. You'll need these View fields later on as values to be processed by your rule, "to set a list widget from active to ended*" (as in your question). Important: use a Views display type of "Rules".
Remove that "add condition" (in the custom rule you started) and, instead, use the Views Rules module to iterate over each of these Views results in a Rules action, using the Rules technique known as a "Rules Loop".
For each iteration step in your Rules loop, perform a Rules Action to "do your thing" (= to set a list widget from active to ended). At that point you'll have all data from each column of your Views results available as so called Rules Parameters. So at that point it's a piece of cake to adapt the value of that list widget for the node you're processing in that loop.
Optionally, you may also want to add whatever extra Rules Condition(s), also up to your own imagination. Typically the things you cannot, or have not yet, expressed as a Views filter. However, if you have a choice between using a Views filter and an extra Rules Condition, I recommend to go for the Views filter, because that will reduce the number of your iterations in your Rules loop (performance!).
Easy, no?

Accessing form elements filling fields?

I have a form which has an initial element, I am running a check using the confidence feature to check for other phrases that might match the user's input. If there are then i am going to a menu, from here i am asking the user to input a dtmf value to say whether one of these values where correct. If the user selects an option, i want it to fill that field of which it checked, with that interpretation or possibly go to another form which does the same thing, if i choose to do it using the other form, can u access filled fields from another form?
regards
According to the VoiceXML Specification the scope for that type of variable would only be accessible in the form. But you can assign the values to another variable before leaving the form that has document scope (i.e. defined just below the vxml tag). Or even give it global scope by defining the variable in the root document, which makes it accessible to the whole application.

Resources