Alexa - How to accept free text as input / slot. Is there any way apart from using a custom slot and providing a huge list? - speech-to-text

How to accept free text as input / slot? Is there any way apart from using a custom slot and providing a huge list? Since Literal slot types are deprecated, how to provide a free text/string input to alexa?

For a slot that accepts a free text you can use the Slot-type: AMAZON.SearchQuery

No, just custom slots or the literal type. You're question is addressed in this Amazon blog post:
Why a Custom Slot is the Literal Solution
https://developer.amazon.com/blogs/post/Tx3IHSFQSUF3RQP/why-a-custom-slot-is-the-literal-solution
But note the recent update "Based on developer feedback we will not remove the LITERAL slot type and you can continue to submit skills that include its functionality."
But the literal type was never supported outside EN-US (US customers) and I imagine that will remain the case which limits its usefulness.

Related

Amazon Lex AlphaNumeric slot issue

Answer for slot by Amazon Lex doesn't when user input are more than 2 words.
I am having troubles with Amazon Lex and Lambda when the user input would not go through when there is more than 2 words when used the "AMAZON.AlphaNumeric" slot type. Does anyone know how to counter this issue?
I hope to see the user input accepting more words and also detecting the words input by the custom slot types on Amazon Lex.
Unfortunately, Lex doesn't really have a built in way to capture free-form text in the way you've described.
The AlphaNumeric slot type isn't meant to capture more than a couple of words which is why it's not working for your purpose. It is primarily suggested for capturing things such as vehicle identification numbers, ID numbers, or certain postal codes. It also supports regular expressions to restrict these further.
If you want to configure your Lex to accept more free-form text like you've shown in your screenshot, you'll need to create a Lambda function to access the inputTranscript.
It's recommended that you create a custom slot type and train it with data that is similar to what you expect from the user. I have sometimes had it work with the AlphaNumeric slot type but this unreliable in some cases. As you've already experienced, Lex slots tend to leave out words and phrases which is why you'll need to create a Lambda to access the inputTranscript. The inputTranscript is the last text received from the user in its entirety.
This post goes into more detail on how to accomplish this. I think it will help you. Good luck and let me know if you have more questions.

How to validate text box in gherkin language?

I need to validate "text box" which does not allow special character,Number more than 10000, and letters,
So my question is how to write in gerkin language ?
Gherkin is not a programming language to have validations. You cannot inject variables into it. However, you can perform the validation in the step definition file and tag it to gherkin.
Scenario: I verify if the characters more than 100
Given I see the text box
And I verify, the text box does not contain characters more than ""
The step definition file
arg !< characters.length
arg is the argument you pass inside the double quotes in gherkin.
Your task is to
Find the value in the text box
The way to do this varies from environment to environment, Selenium may be a good way to interact with your system if it is a web application
Save it in some variable
Validate it against some known value in a step
I have written a few blog posts on how to use Cucumber. This blog post from 2015 may be a reasonable start. The cucumber version is a bit outdated. The process of implementing steps is still valid.
Executable specifications (whether they are in Gherkin format or not) are meant to describe the behavior of the business people. I am pretty confident that not a single business person would talk about the how a single text box should behave.
My advice is to see what the actual business value is about and write the scenario from that perspective. Then the actual testing on this particular text box might not be described in the scenario, but it can be part of the underlying steps implementation.
In other words should the text box suddenly allow for numbers up to a million than the business value probably doesn't change. Therefore the scenario should not change, but the test code behind it might.

Varibale Number Of Characteristics in Custom GATT Service

I am defining a custom GATT profile and have some questions which I could not find definite answers of on Bluetooth specifications.
Can there be multiple characteristics of same type (UUID) defined in a single service?
Can there be variable number of characteristics of same type (UUID) in a service?
For example, depending upon system operation, a peripheral can accumulate variable number of copies of some data.
Can these copies be sent as characteristics to the central when asked for?
Suppose we have a table of data and we want to give access to it in two forms – row wise and column wise.
Can such a requirement be handled in terms of characteristics?
I imagine it like if you request for reading the characteristic with UUID A, it will be read in rows and UUID B will be in columns; is it possible and the right way to do so?
I've just found this unanswered question. Not sure if it's still needed, but here's my answer:
Yes. Page 2224 (Vol.3, PartG: Generic Attribute Profile: 3.3.1.Characteristic Declaration) of Core_v4.2.pdf says: "A service may have multiple characteristic definitions with the same Characteristic UUID".
Yes, it's possible. But in this case you must implement ServiceChanged characteristic. See Vol.3, PartG: Generic Attribute Profile: 2.5.2.Attribute Caching and 7.1.Service Changed.
Yes. It is up to your implementation to define what data is hidden behind custom characteristics.

Are there any benefits using ESAPI's number validations?

I have been asked to add some input validation in all of our REST endpoints. We have two custom validation constraints in our system, wrapping around the ESAPI library; one for String, wrapping #isValidInput and one for Long, wrapping #isValidNumber.
ESAPI's #isValidNumber seems to simply check the number's min and max value (something that I can simply do with JSR-303 #Min / #Max). Are there any added benefits for using the ESAPI library or can I simply remove the custom constraint and add the bean validation annotations?
I do agree that we need the String canonicalization provided by ESAPI, but for the numbers I'm a bit sceptical.
Are there any added benefits for using the ESAPI library or can I
simply remove the custom constraint and add the bean validation
annotations?
In short, yes. If you notice the last parameter in the call to #isValidInput you linked is whether to turn canonicalization on or off. If your application turned it off, the only benefit ESAPI will give you is to outsource your validation regex into validation.properties, where if a prod issue arose, you could change the value and restart the server, saving an application build and deployment. JSR-303 will require a recompile and a deployment.
If however you've left canonicalization on, ESAPI provides one thing that I haven't found in another Java security library to date, which is the ability to detect mixed encoding and multiple encoding on a given input string. From a forensics and incident response perspective, this is ultra-useful as we can tell if our web application is being attacked in real-time, as well as record and audit information about the user performing it.
^^^You seem to know all of this by your last statement. I haven't seen a web container that didn't pass in Strings for numbers. My guess is that you're pulling it from request.getParameter("foo"); which means its a string and you still want the defense provided by canonicalize. Even if it might get caught by a parse exception on the conversion to Integer or Long, there's also the risk of overflow or underflow which could perturb your application in a different way.

Getting data fields AND associated entities into a Word file

NB. This question might be a bit similar to another one but still result in a different answer, hence the division in two.
I'd like to print out the contents of an entity, consisting of a subset of the fields and including some rudimentary information on its associated entities.
E.g. I'd like to print a lead by displaying its name and phone number but also a list of associated instances of type new_somesome (their new_name and new_size, for example) connected to it.
How can I do that?
I've tried cheating by using mail template but that doesn't include the related entities. I'm not sure how to edit the default print view to include the associatees neither.
Is it acceptable for you to use reports?
For this purpose you can try free MS ReportBuilder. MS allows to build reports without using such large tool as MS Buisness Intelligence. These custom reports appears to be more flexible than system ones. Another way is to try Mail merge functionality.

Resources