How to eliminate the "unknown" output in AIML when using ^ wildcard and there are no word captured by the wildcard? - aiml

AIML Code:
<category>
<pattern>Can I reserve a table ^</pattern>
<template>Sure. Your reservation <star /> has been made.</template>
</category>
When I typed "Can I reserve a table for 4", the chatbot will work smoothly and respond with "Sure. Your reservation for 4 has been made."
However, when I type "Can I reserve a table?", the chatbot will respond with "Sure. Your reservation unknown has been made."
How to eliminate the "unknown" in the second output so that it can respond with something like "Sure. Your reservation has been made."?

You can set the default value of unknown values in your system properties. Just remove this line and "unknown" will no longer be displayed.
["default-property", "unknown"],

Related

Remove columns by name based on pattern

How can I remove a large number of columns by name based on a pattern?
A data set exported from Jira has a ton of extra columns that I've no interest in. 400 Log entries, 50 Comments, dozens of links or attachments. Problem is that they get random numbers assigned which means that removing them with hardcoded column names will not work. That would look like this and break as the numbers change:
= Table.RemoveColumns(#"Previous Step",{"Watchers", "Watchers_10", "Watchers_11", "Watchers_12", "Watchers_13", "Watchers_14", "Watchers_15", "Watchers_16", "Watchers_17", "Watchers_18", "Watchers_19", "Watchers_20", "Watchers_21", "Watchers_22", "Watchers_23", "Watchers_24", "Watchers_25", "Watchers_26", "Watchers_27", "Watchers_28", "Log Work", "Log Work_29", "Log Work_30", "Log Work_31", "Log Work_32", ...
How can I remove a large number of columns by using a pattern in the name? i.e. remove all "Log Work" columns.
The best way I've found is to use List.FindText on Table.ColumnNames to get a list of column names dynamically based on target string:
= Table.RemoveColumns(#"Previous Step", List.FindText(Table.ColumnNames(#"Previous Step"), "Log Work")
This works by first grabbing the full list of Column Names and keeping only the ones that match the search string. That's then sent to RemoveColumns as normal.
Limitation appears to be that FindText doesn't offer complex pattern matching.
Of course, when you want to remove a lot of different patterns, having individual steps isn't very interesting. A way to combine this is to use List.Combine to join the resulting column names together.
That becomes:
= Table.RemoveColumns(L, List.Combine({ List.FindText(Table.ColumnNames(L), "Watchers_"), List.FindText(Table.ColumnNames(L), "Log Work"), List.FindText(Table.ColumnNames(L), "Comment"), List.FindText(Table.ColumnNames(L), "issue link"), List.FindText(Table.ColumnNames(L), "Attachment")} ))
SO what's actually written there is:
Table.RemoveColumns(PreviousStep, List.Combine({ foundList1, foundlist2, ... }))
Note the { } that signifies a list! You need to use this as List.Combine only accepts a single argument which is itself already a List of lists. And the Combine call is required here.
Also note the L here instead of #"Previous Step". That's used to make the entire thing more readable. Achieved by inserting a step named "L" that just has = #"Promoted Headers".
This allows relatively maintainable removal of multiple columns by name, but it's far from perfect.

Have screen reader pronounce Country codes in a text input as individual letters

I am working on an Angular app that displays selected Country codes in a text field. This input displays Country codes because of space constraints:
<input type="button" #countryListTrigger matInput readonly i18n-placeholder placeholder="COUNTRIES" [ngModel]="selectedCountries" />
Here's what the control looks like with Country codes displayed:
Countries Widget
Right now, screen readers would read the AU like the letter "o" and AT like "#". I know about the tag, but is there a way to achieve the same result on an input value? Otherwise, I could add another (hidden) control that is read instead perhaps?
It starts getting messy if you try to force a screen reader to announce things phonetically. If you add an aria-label that has aria-label="A U" or aria-label="A T", then braille users will be out of luck because they'll read "A space U".
It's unfortunate there isn't really a good solution for this. The screen reader user can read the input value one character at a time so if it sounds weird to them, they have a work around. It's not a great user experience but having screen readers mispronounce stuff has been a problem for a long time.

How to extract a column based on it's content in PowerBI

I have a column in my table which looks like below.
ResourceIdentifier
------------------
arn:aws:ec2:us-east-1:7XXXXXX1:instance/i-09TYTYTY79716
arn:aws:glue:us-east-1:5XXXXXX85:devEndpoint/etl-endpoint
i-075656565f7fea3
i-02c3434343f22
qa-271111145-us-east-1-raw
prod-95756565631-us-east-1-raw
prod-957454551631-us-east-1-isin-repository
i-02XXXXXXf0
I want a new column called 'Trimmed Resource Identifier' which looks at ResourceIdentifier and if the value starts with "arn", then returns value after last "/", else returns the whole string.
For eg.
arn:aws:ec2:us-east-1:7XXXXXX1:instance/i-09TYTYTY79716  ---> i-09TYTYTY797168
i-02XXXXXXf0 --> i-02XXXXXXf0
How do I do this ? I tried creating a new column called "first 3 letters" by extracting first 3 letters of the ResourceIdentifier column but I am getting stuck at the step of adding conditional column. Please see the image below.
Is there a way I can do all of this in one step using DAX instead of creating a new intermediate column ?
Many Thanks
The GUI is too simple to do exactly what you want but go ahead and use it to create the next step, which we can then modify to work properly.
Filling out the GUI like this
will produce a line of code that looks like this (turn on the Formula Bar under the View tab in the query editor if you don't see this formula).
= Table.AddColumn(#"Name of Previous Step Here", "Custom",
each if Text.StartsWith([ResourceIdentifier], "arn") then "output" else [ResourceIdentifier])
The first three letters bit is already handled with the operator I chose, so all that remains is to change the "output" placeholder to what we actually want. There's a handy Text.AfterDelimiter function we can use for this.
Text.AfterDelimiter([ResourceIdentifier], "/", {0, RelativePosition.FromEnd})
This tells it to take the text after the first / (starting from the end). Replace "output" with this expression and you should be good to go.

Capybara fill_in with xpath

I have multiple input fields with one id specification, but they have different attributes. I can find them just fine, but am having trouble figuring out how to use the fill_in with the find appropriately. Currently I have:
find('//input[#id="specification"][#data-number="1"]').fill_in with: "This first sleeping bag should be 0 degrees F"
Error-- Capybara::Webkit::InvalidResponseError:SYNTAX_ERR: DOM Exception 12
Thanks!
The first is that fill_in will look for a text field within the element returned by find. Basically you are asking Capybara to find something like:
<input id="specification" data-number="1">
<input type="text">
</input>
This is unlikely to exist.
Given that you have already found the text field using find, you want to use the set method to input it:
find('//input[#id="specification"][#data-number="1"]').set("This first sleeping bag should be 0 degrees F")
Assuming you have not changed the default_selector to :xpath, the above will still fail due to the expression not being a valid CSS-selector. You need to also tell Capybara that an :xpath locator is being used:
find(:xpath, '//input[#id="specification"][#data-number="1"]').set("This first sleeping bag should be 0 degrees F")
It's not valid HTML to have multiple elements with the same id. You should start by changing that.

Authorize.net - How to increase "Product Name Maximum character limit"?

I have integrated Authorize.net, but i got the error message "Line item 1 is invalid", then i understood the reason, product name maximum character limit is 31, when submit with short product name it works fine..., but how to increase this "Product Name Maximum character limit"
Please anyone help me!!!!
It's called a "limit" because that's the maximum number of characters you can use no matter what. You can't increase it. If you have products with very long names you should increase an abbreviation that meets the 31 character limit.