I have simple ask, how do I create a Amazon Lex slot for Alphanumeric values.
So far I have tried -
AMAZON.Number: only takes decimal numbers
AMAZON.PostalAdress: takes
everything except numbers
Custom Slot with no values: Only numbers
Is there any way to create a slot which takes alphanumeric values?
Thanks
You can use a custom slot type.
Remember you don't need to enumerate all possible values, just provide enough training data so patterns match. Try giving it around 20-30 values and see if that's enough to train the slot type.
There is no particular datatype to take alphanumberic values.
AMAZON.NUMBER: accepts only numbers
AMAZON.US_FIRST_NAME: accepts only letters
As part of creating a chatbot in Amazon Lex, I have used AMAZON.Movie to accept both letters and numbers(alphanumberic values) it worked for me. As movie name can have alphanumberic values (Ex: The Incredibles2). I hope it works for you too.
Related
I need a formula that can multiply or divide all the numbers in a string without changing the text attached to the numbers.
I need the numbers in the next column to automatically change according to the given mathematical operation, but the text from the original line must remain unchanged.
I've tried using a combination of REGEXMATCH and REGEXEXTRACT and by doing this I just get the result of multiplying/dividing all the numbers in the string (no text whatsoever).
I also had no success using REGEXREPLACE. I'm not even sure we can actually use it in this case, and maybe I need a different formula instead. Maybe you first need to extract the numbers, multiply them and use something like TEXTJOIN or CONCATENATE to put them together in a string with the values already changed, and is this even possible in this specific example? It's totally fine to perform the operation in several steps if needed (for example, adding SPLIT function or something like that), but the format of the raw data we need to enter and recalculate, unfortunately, cannot be modified.
A sample table for better visualisation can be seen below. Any help would be greatly appreciated!
Raw data
Operation
Desired outcome
25STR/40DEX/70FRES
*0.25
6.25STR/10DEX/17.5FRES
80VIT/30INT/50CRES
*0.75
60STR/22.5INT/37.5CRES
60VIT/20STR/45LRES
*1.25
75VIT/25STR/56.25LRES
You may try:
=byrow(index(bycol(split(A2:A,"/"),lambda(z,ifna(ifs(left(B2:B,1)="*",regexextract(z,"\d+")*mid(B2:B,2,99),left(B2:B,1)="/",round(regexextract(z,"\d+")/mid(B2:B,2,99),2))®exextract(z,"\d+(.*)"))))),lambda(y,if(y="",,join("/",y))))
I am creating a chatbot where users need to input their phone. I need to be able to clean the user input string, removing any character that is not numeric. How can I do this in IBM Watson Assistant?
You can use the string functions like those with regular expressions to extract the phone number.
Another, maybe even better, option is to define a pattern-based entity type. The benefit would be that Watson Assistant could identify parts of the input as phone number entity and you could match dialog nodes or slots for it. If that is not found ("else") you could apply the extraction of numbers and try to guess if that is a phone number.
I would advise you handle user input at the client side. In your case, use the key-pressed event and an "If statement" to check that the character is a number (equal or greater than zero). Alternatively you can add the natural language understanding (Easy to configure machine learning service) to Watson Assistant to make it more intelligent. In this case, Watson will be able to know if data is a valid phone number or not.
Does anyone know if there is a way to manipulate the recognition of phone numbers when using the Google Speech API? I am trying to implement a transcription scenario where a caller will say a string of letters and numbers, but the logic out of the box seems to be to try to fit any sequence of numbers to a phone number scheme, even if it means rendering letters into numbers they may sound vaguely similar to (or not). I have tried using speech contexts to manipulate the values within the "phone number" by typing out and giving the entire thing as it should be as a speech context ("eight seven seven two bee three seven", for example), but it refuses to override the digits being interpreted as a phone number. Has anyone encountered this issue or is aware of any way in which this could be worked around?
Thanks!
I'm not aware of an easy way to do this. For the Web Speech API for JavaScript, doing the following seems to yield fewer results that are forced into phone number format.:
Set the maxAlternatives = 2, e.g.,
var recognition = new speechRecognition();
recognition.maxAlternatives = 2;
Then use the second result offered, e.g.,
constr speechToText = event.results[0][1].transcript
You can get pretty far by processing the result. A remaining challenge is that since the result often clumps digits together, you lose the distinction between a series of single digit numbers and one multi-digit number (e.g., '15' & '1', '5'). The utility of this approach depends on the specifics of the numbers your app is trying to capture.
In at least one case, setting the language to en-PH (English Philippines) seems to have fixed, or at least notably improved, this problem. Other English language options might work as well.
en-GB comes back as a UK formatted number where they put one digit first then the rest of the number.
I'd like Alexa to be able to accept a variable-length list of English letters to my custom skill. It will allow users to search based on a string.
There's two steps to this:
Getting good representation for individual letters that Alexa can understand
Enumerating sample utterances with variable number of letters
For the first, one way would be to define a custom slot that has as its enumerated values of the English alphabet:
SLOT_LETTER
ay
bee
see
dee
ee
eff
gee
... etc
but that feels hacky. Does Amazon support any way to do this or is there a cleverer way?
I'd really rather not use NATO phonetic ("alpha bravo charlie" for "A-B-C") because it's a terrible user experience and very few people actually know them.
For the second issue (sample utterances), for AMAZON.LITERAL I want to define something like:
SpellIntent find me things starting with {first second|SLOT_LETTER}
SpellIntent find me things starting with {first second third|SLOT_LETTER}
SpellIntent find me things starting with {first second third fourth|SLOT_LETTER}
But I don't think Amazon will let you define a variable length LITERAL using a custom slot (since they are different "types")?
It isn't very well documented, but you can use "a.", "b.", "c." etc to represent the letter, as opposed to the sound. Create a custom slot and use these as the values. That should do you for the slot.
For the intent, create an intent with, say, five slots, all with the same slot type. Create five utterances against the intent, with one, two, three, four and five slots filled. When the user spells something, the intent will be invoked. Any slots the user did not specify will be null.
Having two slots in one intent not separated by a word often does not perform well. But try it and see. With a restricted vocabulary like this, it could do OK.
Lastly, if it has trouble distinguishing, say, "b." and "v.", you might try adding NATO call codes to your list. Alpha, Bravo, Charlie, etc. Then, in your processing, just take the first character of whatever value comes in for the slot.
You might enable the "Star Lanes" skill and experiment with the "Set Call Sign to X Y Z" intent. I do the above in that skill and it works fairly well.
I would avoid this kind of interface because it can be difficult for users to spell things, and difficult for Alexa to differentiate letters (b or v, perhaps). But if you want to try this, consider using the literal type and asking for letters in groups of three or four.
AV: "Spell the first four letters now"
User: "see ay are tee"
AV: "You spelled C, H, R, T. Would you like to add more letters, make a correction or search now?"
User: "Cancel. I'll just use my damn phone."
Fairly new to classic ASP(maintaining legacy applications) and I need to figure out how to fish out values from a string. String itself can look something like this - 0,12,234,543. I was thinking about making a function where I can specify which number I want from the string for ex.
Function fnGetNumber(string, 3)
// returns the third number(number after the second comma ie. 234)
End Function
The string will always have only numbers and always 4 of them. Also they will not have decimal places.
The function itself is not a problem, but I can't figure out the regex.
Using Split is the way, use it to transform the string to an array and pull the data from that.
I wouldn't recommend regex as whilst it powerful, its readability is poor.