Match slot to multiple values - action

In my skill I'm using a Custom Slot for a list of Programs. These programs have a list of synonyms/alias that resolve to the Program title if matched. Sometimes it's possible that multiple programs have a common synonym, in that case I would need to return to the webhook the list of the Programs instead of only one of the Programs with that Synonym.
In the following example, the two Programs have a common synonym "rubrica".
enter image description here
In my Intent I used the custom Slot type "programs" and flagged the "List" option
enter image description here
With the following utterance:
enter image description here
But if I try to say "mettere rubrica" the slot is filled with only one of the two options. Instead, I'd like the slot to be filled with a list of all programs that have that Synonym, how can I achieve this?Thanks in advance

Related

Searching a large data file for a credit card type and its relevant info

So I am running Python 3.7.1 and I am trying to make a program that pulls out only customers that use an American Express card and display only their name and Email.
I have part of the code that pulls all the customers data that uses the same card type, but it pulls up multiple of the same name and email and all other information. I just can't figure out how to eliminate multiples and only display Name and Email. Below I will show a picture of my code and a screen shot of the output for reference.
My code so far
Output(notice the multiples of Mary and Hunter)
Assuming your file isn't extremely long, consider using Python's set data structure to filter out duplicates. You can check for membership within the set via the in operator (e.g. x in s) and you can add new elements to the set via the add() method (e.g. s.add(x)). At a high level, you want to amend your code to check whether the element is already in your set (in which case you don't need to print it again), and if it is not in the set, add it to ensure you don't print it again.

How to create an intent with multiple slot values in its utterances in AWS Lex?

How do I create an intent which expects multiple consecutive slot values in its utterances which are set to expandable values? In the screenshot, the manufacturer model variant trio appears together in the utterances. Problem is the manufacturer and model slot types has possible two-three word values and variants could go up to five words. Lex is not able to understand the manufacturer utterances and straightaway detecting model slot type. How do I deal with this issue? Thanks.
intent utterance test chat screenshot slot data screenshot
You should greatly increase the values listed in your manufacture slotType so that it can better detect all the possibilities, especially since you need it to differentiate from the next slot.
Then also increase the variations of the intent utterances.
The error looks like the slotType is set to "Restrict to Slot values and Synonyms" so make sure you have it saved, built, and published with the setting "Expand Values" applied.
You should try to "teach" Lex as much as possible with all the expected variations of slotType values and utterances, but there will still be things that Lex will fail to catch. So I highly suggest using Lambda to parse the slot values, and sometimes the input itself so that you make sure the values are placed in the correct slots.

Which component of MV should transform raw data into user friendly format?

There is a structure that holds raw data (consider int) and a gui that should visualize this data. Gui part consists of a few models and and a few standard views (table and tree). The value should be presented either as a string or as a picture depend on user choice. There are some additional difficulties: in some cases the text is different for different elements - i.e., for the same column 0 normally means "Ok", but for a particular element it should be printed as "Yes", also depend on a user choice some columns should not print text for 0 values at all, living a cell empty and don't clutter the table; next, sometimes cell should show two values - e.g., current value and requested - something like "Yes -> No". This also applies to the case when user wants to see icons.
I see two options:
The model forms string text itself and store it somewhere (in the model item may be). The model also forms composite icon from base icons if it is needed. In that scenario I can use standard delegate and just use standard roles reimplementing QAbstractItemModel::data() method.
Reimplement delegates' paint() method (actually I need to reimplement delegates anyway because I need custom editors like QComboBox). The delegate can get any information it needs through the model and custom roles in paint() method and form the string or complex icon itself. As a suboption, I suppose, it's possible for a model to compose needed information itself, like returning std::tuple<int /*value*/, int /*requested value*/, int /*source element type*/, bool /*text or icon*/> in data() method for Qt::DisplayRole.
Update: I want add one thought about second option. Presumably delegates were introduced to handle the work of representing data. One of the consequences of that is the flexibility delegates can give. If you want to see a raw number in some column, you can just leave the default delegate, if you want some additional info presented in a cell you can set a special delegate for that specific column. And it seems you don't need even touch the model or something else.

C++ about multisets and arrays

I have had the displeasure of being saddled with a textbook that isn't written very well. As it stands, I went from enjoying C++ to being physically ill just thinking about it. However, I refuse to quit the class. So the long and short of it is I have a lab that asks the following:
Write a program that contains two arrays called actors and roles, each of size N. For each i, actors[i] is the name of an actor and roles[i] is a multiset of strings that contains the names of the movies that the actor has appeared in. The program reads the initial information for the these arrays from files in a format that you design. Once the program is running, the user can type in the name of an actor and receive a list of all the movies for that actor. Or the user may type the name of a movie and receive a list of all the actors in that movie.
Now, I don't want the answer. I just need to know what direction to start heading to. I feel pretty comfortable with standard arrays, but the way multisets are described in this textbook confuses me to no end. Any assistance (without just giving me the answer) would be appreciated.
The way its done is to have a third auxiliary multiset linking actors to films.
This third set only needs to contain pairs of unique integers. Say user picks actor 'wayne' first step is to form auxiliary subset of pairs of integers(actor_id,movie_id),each actor has an unique integer id, each movie has an unique integer id , then iterate through this set to obtain all movies as values to these keys.
Going the other way: if user picks film 'rawhide' again form subset of integers and iterate through this to find all actors as values to these keys.
Look up 'many to many relation' for further info.

My test script is not finding items in dynamic web list control - list in code not updated with current info

I am having a problem in QTP with selection of a web list box and I have exhausted what I know to do to resolve it. I am hoping someone can help.
There are 5 controls in a container, 2 webedit controls and 3 weblist controls. Together, they allow entry of accounts associated with a customer, and there can be 16 accounts for any customer. There are only ever five controls active at any time, whether editing or entering information for an account. When the information for an account is entered and accepted, it changes to a read-only table row and a new set of controls appears below it for entry of the next account.
The information entered in these controls is the account number, type, description, designation, and status. The status value is contingent on the designation, and the items in the list change dynamically depending on what the user specifies for the designation. The status list is not enabled until the designation is specified.
After some experimenting with timing, I was able to get past an issue where the status list for the first account was seen by QTP as disabled even though it was clearly enabled. I was then able to advance to entry of the second account.
I change the designation on the second account and try to select an appropriate item (specified in a data table) in the status list. My specification from the data table is never found. I figured it was a problem with verbiage differences and also that I should probably anticipate that and address it now, so I wrote a function to accept three parameters, the list and up to two search items. My function searches the listbox passed to it and looks for a match (full or partial) on the search items it receives. Here is where I encountered a significant problem.
The list of the control my function received was from the previous iteration of the test, corresponding to the designation of that account. This is why my function was not finding the selection item. The list on the screen shows the appropriate items, which suggests that I am looking at the wrong object. I also get the ‘object is disabled’ message when I put my data table value directly into the list with the select statement.
The active controls are displayed below the readonly presentation of the previously entered accounts. I am very new to QTP, but I also read documentation. My only theory at this point is that ATP is not passing the right list to my function… that perhaps that how it was learned included the position, which will change each time. However, the spy identifies the screen control as the same item I processed for the preceding account, which makes my theory suspect. In addition, the other four controls, which are not dynamically changing, do not present the same problem. I can put the information in them consistently.
I apologize for the length of this question, but I wanted to be as thorough and clear as possible. Can anyone help me get past this obstacle.
There are many possiblities why it is exposing this behaviour, so let's start with something simple:
Did you try a myWebList.Refresh call before you do something with the listbox? Refresh re-identifies the object.
Have you put a break point (red dot) inside the custom function. Just see what is happening there. With the debug viewer you can enter a realtime command in the scope of that function like msgbox myWebList.exist(0) or myWebList.Highlight
Can you see how the disabled property is propagated to the webpage? If you can 'Object Spy' it as TO property, you can add it in the GUI Map description.
A more sophisticated aproach is to create a Description with the weblist properties. If you can read the disabled property as an RO property from the 'Object Spy', you can use it as an identifier like "attribute/customDisabledProperty:=false".
If you cannot correctly read the disabled property, you can create a description object and do a count on the amount of items that match that description on that page with numberOfLists = Browser("my browser").Page("my page").ChildObjects(myDescription).Count and get the last list with Set lastList = Browser("my browser").Page("my page").ChildObjects(myDescription)(numberOfLists-1)
Keep us informed. Depending on how this works out, we can work into a direction for a solution.
I figured this out early this morning. There are 4 different list boxes used, each made visible or enabled dependent on the selection of the previous list. This is why the spy found the one listed when I was using it and also why the items in the list were not appropriate to what I had selected and also why it appeared disabled to QTP but enabled to me.
I was selecting the same designation when trying to spy it. It was intuitive that the controls were all the same. I am also a windows programmer and I would have populated the same list each time with the appropriate list items, and I presumed that was what the web developer was doing. It was not and it took some time to figure that out. Now that I figured it out, everything is working fine, and I came back to report that. This was a significant, time-intensive lesson.
Thank you very much for your input. It is still useful because I am very new to QTP and every thing I learn is of value.