Amazon lex is not giving a successful response for values other than the defined slot values - amazon-lex

I have a custom slot type defined and I have put slot values like 32, 34, 36, 38, small, large. I have set the Slot Resolution to 'Expand Values'. I have an utterance 'Show me option 32'.
I have assigned the slots to the utterances. I save the intent and build the bot. When I try to test the bot, it gives a success response only to the values mentioned in slot type. If I type, 'Show me option 34' or 'show me option 38' or 'show me option small', it responds with a success json. If I give any other number other than specified slot values, the dialog state shows ElicitIntent and bot responds saying 'Sorry, can you please repeat that?'. Eg: 'Show me option 41'
Why is lex not identifying other numbers? Am I missing anything?enter image description here

Just make sure that a slot is required in your intent. In aws-lex you entered values in expand values, it will consider any number type like.
now "show me 41" also it will work .after slot is marked as required. If you won't mark as required it will directly fulfill the intent. If you make it required it will elicit the slot and then it will search for respective slot.

Related

Need to manipulate results of line item with a code step in Zapier

Screenshot of my sample
I have a python code step that returns a line item object with the names of some components, their component IDs and the allocation of the components (see screenshot)
Now I need to return ONLY the set of values where the component_allocation is greater than 1 and the name of the component contains "User"
In other words, for the data in the picture I want to return:
Component Name: Additional User, Enterprise, annual
Component Allocation: 5
Component ID: 587086
Are my commas in the component name going to make this impossible? I'm not great at coding (wild understatement) and I don't understand how line items work very well. I can ALMOST do this with a spreadsheet style formula step instead of a code step because it has line item support, but no FIND or SEARCH function to match the word "user"
I've run into this before. Luckily, you have control of the return in your Step 3 code step. I tackled it by:
Return a list of JSON strings rather than (or together with) a list of objects. Your return would look like:
[
'{"component_allocation": 0, "component_name": "Addition user, monthly", "component_id": 565257}',
'{"component_allocation": 5, "component_name": "Addition user, yearly", "component_id": 565258}',
'{"component_allocation": 25, "component_name": "Addition user, biennual", "component_id": 565259}'
]
Convert the JSON string to an object in your new code step.
Run you normal code now

How to count instances of text

I have a list of email addresses in SPSS. I'm trying to write syntax to count how many times each email address appears.
For instance:
In my desired output, if johndoe#aol.com appears in the data 3 times, I want all instances of his email to show a 3 in my new column.
I know I can write syntax to have it count (ie johndoe#aol.com will be assigned 1 the first time, then 2 then 3)... but this is not what I want.
Thanks!
Steps to do this:
Sort cases by email.
Get the counts using the Aggregate command.
Use the Identify Duplicate Cases command to generate an indicator of whether a given email is the first of its kind in the file.
Select cases that aren't the first with that particular email.
All four of those commands are in the Data menu in the GUI. Syntax to do the whole thing:
SORT CASES BY Email.
*This will create a new variable N_EMAIL with the counts. It will appear for every case.
AGGREGATE
/OUTFILE=* MODE=ADDVARIABLES
/PRESORTED
/BREAK=Email
/N_EMAIL=N.
*Now we generate a "PrimaryFirst" indicator showing whether a given case is the first instance of its email.
MATCH FILES
/FILE=*
/BY Email
/FIRST=PrimaryFirst
/LAST=PrimaryLast.
DO IF (PrimaryFirst).
COMPUTE MatchSequence=1-PrimaryLast.
ELSE.
COMPUTE MatchSequence=MatchSequence+1.
END IF.
LEAVE MatchSequence.
FORMATS MatchSequence (f7).
COMPUTE InDupGrp=MatchSequence>0.
SORT CASES InDupGrp(D).
MATCH FILES
/FILE=*
/DROP=PrimaryLast InDupGrp MatchSequence.
EXECUTE.
*Filter out duplicate cases.
SELECT IF PrimaryFirst = 1.
EXECUTE.
*Final cleanup.
DELETE VARIABLES PrimaryFirst.
Just run this:
AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=EmailAddress /num_instances=N.
A new column will appear in the dataset called num_instances (you can of course select another name) which will have the desired count appear in all instances of each Email address.

How can i delete the value of a column in powerbuilder?

I have a datawindow with 3 selection criteria. This selection criteria are 3 columns. If the user writes something in one of them, than he can't use the others. If he tries to do that a message aware the user that he can use only one criteria. The problem is that after he deletes or cuts what he wrote before and he tries to write something in another column, the message still pop-up. I think that the buffer still contain the last value. How can i reset it?
I guess you have to nullify the 'deleted' column. I would do it that way: in the 'ItemChanged', post:
if dwo.name = 'yourcolumn' and data = '' then
SetNull(ls_null)
post dw_selection.Setitem(row, dwo.name, ls_null)
end if
This, of course, needs to be adapted to suit your needs.
Check the "itemchanged" event of the datawindow with the returned values:
Return value
Set the return code to affect the outcome of the event:
0 (Default) Accept the data value
1 Reject the data value and do not allow focus to change
2 Reject the data value but allow the focus to change

How to change format / treat missing values in SPSS

I'm using SPSS modeler and I have a variable that the software recognizes as numeric. So the missing values are $null$. I want that the missing values of the variable are selectionable with '', as character.
So I would: or trasform the format of the variable from numeric to character or change only the missing values from $null$ to ''.
How can I fix?
thanks in advance
The best way to select null values in a numeric field is to use the #NULL() function from the Blanks and Null section of the Expression Builder.
For example, if you wanted to keep only the null values so that you could inspect them, you might use a Select node. Leave the radio button set as Include. Press the Expression Builder (calculator) button. Change the filter in the drop menu on the left side from General Functions to show Blanks and Null (press B 2 or 3 times). Double-click on #NULL(ITEM). Go to the right side and double-click on your numeric field name. Put a Table node at the end and run it.
Using Select #NULL in IBM SPSS Modeler
Another way to view just the null rows is to enter the #NULL(varname) function into the "Highlight records where" section of the Table dialog box.
"Highlight records where" dialog
When you run the table, any row that is true for this condition will be shown in red.
If you really need the variable to be a string, then use a Compute node to create a copy of this field under a new name and use the to_string() function in the Conversion section of the Expression Builder to change the type of the variable. Now you will be able to use the the Select node to grab "" as the missing value. Or you could use the Filler node to replace the column, but then you would not be able to compare before and after.
The dialog examples shown in this answer use this sample stream that is installed with your IBM SPSS Modeler software:
C:\Program Files\IBM\SPSS\Modeler\18.0\Demos\streams\featureselection.str
The easiest way to do it it's using the Fill node with the configurations:
A) FIELD
B) Condition = #NULL(#FIELD)
C) Replace by = ' '
This node will replace all $null$ for ' ' at the same variable chosen in option a.
I don't think you can customize how you visualize $nulls. (I know it's possible in SQL db though)
So I'd suggest that you work with the numbers and when you want to visualize or export the results, then turn the field to a string one then replace nulls:
Filled node > to_string(#FIELD)
Filler node > blank and nulls > #FIELD = ''

Listing two or more variables alongside each other

I want an alternative to running frequency for string variables because I also want to get a case number for each of the string value (I have a separate variable for case ID).
After reviewing the string values I will need to find them to recode which is the reason I need to know the case number.
I know that PRINT command should do what I want but I get an error - is there any alternative?
PRINT / id var2 .
EXECUTE.
>Error # 4743. Command name: PRINT
>The line width specified exceeds the output page width or the record length or
>the maximum record length of 2147483647. Reduce the number of variables or
>split the output line into several records.
>Execution of this command stops.
Try the LIST command.
I often use the TEMPORARY commond prior to the LIST command, as often there is only a small select of record of interest I may want to "list"/investigate.
For example, in the below, only to list the records where VAR2 is not a blank string.
TEMP.
SELECT IF (len(VAR2)>0).
LIST ID VAR2.
Alternatively, you could also (but dependent on having CUSTOM TABLES add-on module), do something like below which would get the results into a tabular format also (which may be preferable if then exporting to Excel, for example.
CTABLES /TABLE CTABLES /VLABELS VARIABLES=ALL DISPLAY=NONE
/TABLE A[C]>B[C]
/CATEGORIES VARIABLES=ALL EMPTY=EXCLUDE.

Resources