NLU - extract string that is related to entity - amazon-lex

is it possible in any NLU (e.g RASA, or Lex) to get attrbitued string of an entity?
Here is an example:
"please make sure to remind me about getting the project done"
let's say I'll put remind me as a REGEX - how can I extract the latter?
I'm talking about NLU perspective (and not naive string manipulation).
would like an output like
{
Intent:"remind_me"
Value:"about getting the project done"
}

Here's a description of how to do it in Lex.
From your example:
User: "please make sure to remind me about getting the project done"
This is the user input, also called an Utterance.
First you create an Intent. You can name it like you did: remind_me
Then you provide Lex with intent-utterances, or phrases that the user will say to trigger that intent. Perhaps, something like:
"remember this for me"
"make a reminder"
"can you remind me about something"
"please remind me"
Those would simply trigger the intent and you can then ask the user for the information to remember.
Any value that you want to store in Lex is called a Slot Value because it is held in a Slot, which is basically just Alexa and Lex's term for 'variable'.
You could name the Slot: reminder
If your intent is triggered, then you Elicit Slot and ask the user:
"Okay, what would you like me to remind you about?"
You "teach" Lex what to listen for by providing all the variations of utterances you think the user might say, and simply place the SlotName in curly braces {} inside the utterance at the point where they are likely to say the word or phrase you want to store in the Slot.
"remind me about {reminder}"
"please remember {reminder}"
"make sure to remind me {reminder}"
These can even be the intent-utterances so you capture the reminder value without needing to elicit it with a question.
Lex will then provide you with exactly what you are looking for and more, I'll simplify the JSON that Lex creates for you:
}
"currentIntent": {
"name": "remind-me",
"slots": {
"reminder": "about getting the project done"
}
},
"inputTranscript": "please make sure to remind me about getting the project done"
}
To view the full format see Lex Lambda Function Input Event and Response Format
Notice that Lex even provides the full user utterance in inputTranscript. That's great for doing your own parsing and validating.

Related

How to transmit alert variables by E-mail message

I’m a newbie in AggreGate IoT platform and I’m trying to use its Alerts feature. I need to insert the name of the device that triggered the alert into the email message being sent.
I see some Alert Examples in the documentation but I can’t find the way to extract the context of the current device. I’ve tried to write the Alert Message expression like {env/context} or cell({env/context},"value") but it has no effect.
Please help me to make it work.
You need to send e-mail when Alert rises or deactivates, but with your own subject and message format.
Open "Automatic Corrective Actions" tab
Add action "Execution type" - Rise, "Action" - Send E-mail and click on "Parameters" field.
You should see e-mail sending parameters, such as Recipients, Subject, message, etc. You can write it by yourself or use bindings, in our case we will use bindings.
To get variables from alert we should use an expression for ex. "cell({env/value},"trigger")". This expression will return "Trigger message". You can get any variables that we have in Alert Event (see attached screenshot).
When you get variable value, you can use it with AggreGate expression language. For example, if you get cell({env/value}, "context") it will return context of the device for which this alert was set. You need to get name of this device, using context - you can write expression cell(getVariable(cell({env/value}, "context"),"genericProperties"),"name").

Can Siri Shortcuts handle dynamic phrases and variables

i want to know is it possible for user to say
"balance in all cards" or "balance in home" or "balance in work"
how can user acheave this with one sentence
now user has to invoke siri siri with static phrase like "show my balance" then it askes for which card? then user ansers that to get the value
is it possible to do it with one sentense like:
"Balance of </Home/> card in cashAPP"
this way it introduce a whole new possible way of entering data with siri
imagine you could say :
"new expense in home category with 20 dollar"
is this possible
Unfortunately, this is not yet possible although the system shows promise for this feature.

How to define a synonym for a Siri intent param keyword?

I am developing a Siri extension handler for INTransferMoneyIntent. In this intent there is a param toAccount which Siri can parse out from your request and pass to your handler. It can successfully parse out any values for the toAccount param even if they are not registered in the app(through the global AppIntentVocabulary.plist or through INVocabulary). But it can only recognise the account name from the request if the request contains the word 'account' before or after the actual account name. Say: 'transfer $3 to Beer account'. Or 'Transfer $10 to account Beer' where 'Beer' is account name. And this is totally fine as this is exactly what this intent is supposed to be used for. But my customer wants that instead of the word 'account' the app could be able to recognise the account name by the keyword 'category'. Like in the phrase 'Spent $30 on Beer category'. Or even simply 'Spent $30 on Beer'.
I know that I could add custom vocabulary through AppIntentVocabulary.plist or through the INVocabulary class. But it seems to allow only setting the possible values for the intent attributes(in my case for the attribute INTransferMoneyIntent.toAccount.organizationName of INTransferMoneyIntent.toAccount.nickname) but not to provide a synonyms for the keyword itself that is used to recognise a param from the request phrase.
I am 99% sure that it is not possible to achieve that, but who knows.. Maybe there are some hidden options I have not discovered yet..
Any suggestions?
I confirm this is NOT possible.
Unfortunately you cannot use the AppIntentVocabulary.plist to define synonyms for the keywords that define the intent.
At least today with iOS 11.2

Same step using different step definitions Serenity Cucumber

I am automating a system using BDD with Serenity + Cucumber-jvm, and I have some cases, that the same step can be used as any keyword step definition.
Example:
Given something
When do something
Then other thing
And do something
As you can see, do something is used with both when and then, but If I define the same method with these 2 annotations:
#When("do something")
#Then("do something")
public void doSomething() {
}
I get the following error:
cucumber.runtime.DuplicateStepDefinitionException: Duplicate step definitions in ...
How do I resolve this issue
"Given" describes the context in which the scenario takes place. It either describes a state, or it describes something that has happened. So phrase it in either the continuous present, or the past tense.
Given the invoice is two weeks late <-- continuous present
Given the invoice was submitted <-- past
You'll also notice that it doesn't say anything about who submitted the invoice. That's fine for the context, because it doesn't matter how it got there. We call this the "passive" as opposed to the "active" voice.
"When" describes an event that happens. I like to put this in the present tense, active voice. "The dog bit the boy" is active voice. "The boy was bitten" is passive since it doesn't mention who did it. By mentioning who does it, we remind people that there's a user involved, even if that user is another system.
When I check my accounts
When the admin creates a new record
When the ETL begins
"Then" describes what ought to happen, in that context, for that event. I like to use the word "should", which is a conditional tense. It's also in the passive voice because the "when" should cover how it happened.
Then the invoice should be marked as paid
Then I should receive an email <-- "I" am not the doer so this is still passive voice
The word "should" has an additional benefit. Back in the days of Waterfall development, we used to try to get all the requirements right, but we never quite managed it.
By using the word "should", we encapsulate the idea that uncertainty still exists. It encourages people to question whether the requirements are accurate, and in the face of changing technology and innovation, whether they're still accurate. It's easier to change an idea when it isn't using "must" or "will", as those are words which express certainty, and if you're convinced that someone else is certain about something, you're less likely to push back.
By pushing back and making other suggestions we get "exploration by example", and it's the precursor to specification or test by example, which are nice by-products. Ideally you'll be talking through more scenarios than you actually keep, and deciding which ones are in and out of scope. The word "should" really helps with that, and keeping it when you capture those scenarios and write them down helps too.
And, of course, it helps to differentiate "Given" and "Then" (but hopefully not "When" since that will be phrased in the active voice anyway).
So, if I were to use your "do something" example, I might say:
Given something was done
When someone does something
Then something else should have happened.
Now none of your scenario steps are similar, and you've clarified what you really mean by them, too.
I wrote a blog post on this a while back if it helps as a reference.
For Cucumber The keyword in front a step definition (Given,When,Then,And..) does not make any difference it is for lexical clarity and beauty. That said when you do
#When("do something")
#Then("do something")
is equivalent to:
#When("do something")
#When("do something")
or
#Then("do something")
#Then("do something")
So not to get duplicate step definitions you need just to look at the text not the keyword :)

Getting value from input box of one page and passing it to the heading of another page

I have a feature I'm struggling to implement, didn't find a proper answer anywhere.
When a user puts some text in an input form and clicks a "next" button, he sees the input text as a heading of another page.
You can login to my app to see exactly what I mean: http://murmuring-headland-8091.herokuapp.com/
For example, a user writes down a decision he wants to make: "Which job to choose?", and after clicking "What are your options?" button, he sees "Which job to choose?" instead of "Step 2 of 4.".
I think what I want to implement is called "a string", but I can't go any further with that knowledge.
Hope I made my question clear. I'm a newbie, so I hope to get a detailed answer.
Here's the github of my app: https://github.com/strikhar/decisions
Thank you for taking your time and helping me!
The input field "Which job to choose?" has no name associated with it. So, you need to assign it a name for accessing the input given by user.
Once you assign it a name, say whichjob, you will be able to access its string through params[:whichjob]. Then using this, you can display this string in place of "Step 2 of 4."
Instead of using this means
What are your options? ->
use a submit field for the same. For example,
<form action='/options'>
.
.
.
.
<input type='submit' value='Submit it now and go to "What are your options?"' />

Resources