Amazon Lex - receive spoken spelled out word, what slot type should I use? - amazon-lex

Goal
User should spell out their name one letter at a time, for example: "s a r a h" / "ess ay are ay aych".
Lex should understand and convert it to text together: "sarah"
What I've tried
I'm using Amazon Connect (IVR/phone, user speaks into the phone to spell their name) which is using Lex to listen and convert to text.
I've tried a "AlphaNumeric" slot but it rarely works. I've also tried custom slots for all letters e.g. "a.", "b." - also rarely works.
Has anyone dealt with this? Any direction/experience would be appreciated re. handling spoken (not typed/chat bot) letter-by-letter input using Lex and preferably also Connect.
Other research I've done
https://forums.developer.amazon.com/questions/9331/letter-of-the-alphabet-slot-type.html - this author apparently took the custom letter slot approach, but doesn't really confirm if it worked overall. I've tried this and it's not working, but maybe I'm missing something important.
https://forums.aws.amazon.com/thread.jspa?threadID=261741 - AWS support thread which isn't very helpful

If you click the + next to Slot types you'll have the option to Extend slot type. If you click this you can create a new slot type with a regular expression based on your use case. For a first name that might be [a-z]{2,25}. I think the max length for these is 30, so [a-z]{1,40} would fail.

Related

Amazon Lex custom slot type issue using EXPANDED VALUES

Our team has been developing a chatbot with Amazon Lex for around 3 months now and we need a slot type that will accept ANY last name. The built-in AMAZON.US_LASTNAME slot type appears to be limiting and we need every name to be accepted the first time they are entered.
We created and trained a last_name custom slot type with a significant enumerationValues list and set the slot resolution to EXPANDED VALUES to theoretically accept any value (I believe that’s how it works but happy to hear otherwise). Our last_name slot type is not accepting any last name that is not in our enumerationValues list, so it appears the EXPANDED VALUES resolution is not working as I understand it should be.
Any advice on how to create a custom slot that will accept any last name?

Convert ID from speech to text without spaces

I'm using Google Cloud Speech API with IBM Voice Gateway in order to interact with a VoiceBot through a phone.
If I say an identifier contening letters and numbers through the phone, the Google Cloud Speech converts it into string with spaces. For example, if I say "A1B2C3", it will convert it into the following string "a 1 b 2 c 3".
Do you know if there is way to avoid these useless spaces ?
Thanks for your help!
Lucas
I don't see any way in which you can eliminate spaces from the API response. What you could do is experiment with the available features, as this is probably your best chance to get a recognition more similar to what you are looking for.
For example: you can provide some sample hint phrases echoing your use case, indicate that the audio is a phone call, or use an enhanced model (although for the latter to be available you need to first opt in for data logging).
Honestly though, for your case, it might be better if you post process the returned string (e.g. with a simple "a 1 b 2 c 3".replace(' ','') ).

Making custom slots using Regex in amazon Lex

I want to make custom slots that accepts any and all entries as long as those entries follow a certain regex pattern, eg:any number of alphabets or numbers but without a space in between. Can anyone tell me if there is a way in amazon lex to achieve it?
Also, if I want to take a certain type of data, say, email ids, but want to give the user option to give any number of email ids (more than one), what is the way to do that.
I am new to Amazon Lex and any suggestions would be appreciated.
Make a slot in Lex console in your intent but do not tick as required, and give any type as slot type.
Now in lambda code, first set the slot to null and then parse the inputText using regex and assign the correct value to the slot.
This way both of your problems will be addressed.
Hope it helps. Let us know if you run in any problems.

Validate User Inputted Text is Family-Friendly

I'm working on an iOS app that involves user input, and I'd like to keep it kid-friendly. One of the main features of the app is that user inputted titles and phrases can be shown to everyone who uses the app.
When a user creates a new title I want to verify that it is safe-for-work. My initial thought was just to have a list of all profane words and verify that none of them exist in the title:
for bad_word in list_of_bad_words:
if bad_word in user_inputted_title:
// Complain to user!
// Title is okay.
I imagine that there must be libraries or best practices for doing this. People could easily substitute numbers for letters, and I'm sure there are sequences of SFW words that create inappropriate phrases.
Can anyone suggest a better way of doing this? Specifically, if there are any Swift tools that would be awesome!
There are some cocoapods for this:
https://github.com/IslandOfDoom/IODProfanityFilter
https://github.com/MaxKramer/SCRProfanityChecker
I haven't used either of these personally, but I hope these can be a good starting point. The first one replaces any profanity with asterisks, and the second can give you the range of the profanity so you can replace it with your own filler. Good luck.

UITextChecker is what dictionary?

Does anybody know what dictionary UITextChecker pulls from? I use it to verify that a word is in fact a valid word in an app. I have some questions from users about why specific words are available in other games (Boggle/Scrabble) but not in mine.
Examples: ai, qi, qat, xu, ae, tae, ait, ain, lav, aa, shh, za
I checked against /usr/share/dict/words and none of these words are in Websters Second International, so maybe UITextChecker uses this same source? They do show up in other dictionaries online (but this is really besides the point of the post).
Thanks for any insight!
UITextChecker may be using the same dictionary that UIReferenceLibraryViewController uses. In which case, you could use something like [UIReferenceLibraryViewController dictionaryHasDefinitionForTerm: #"term"] and if it returns true the word exists. I'm not sure how complete the built in dictionary is however.
I guess it uses the iPhone dictionary of the user, which depends on the current language/NSLocale the user is using (which is set in the "International" Settings on the iPhone). This is the behavior we observe when typing some text anywhere in the iPhone, words underlined in read (because detected by the internal UITextChecker) depends on the locale used.
If the user have activated multiple keyboards with different languages each (e.g. a French AZERTY keyboard and an US QWERTY keyboard) it depends obviously on the current language, namely the current keyboard active at this moment.
If you refer to the wordfeud dictionary... (that would be the only game I know those words from). They check their words from an online dictionary on their own server. Must be a list parsed from another spelling site or something.
I sometimes doubt the validity of some words though....

Resources