How can I help Google Assistant understand (not auto-correct) non-word inputs.

783 views Asked by At

I'm making an app for the Google Home using the new Actions on Google functionality. Part of my app requires the user to input letter-number pairs such as "P7". However, when testing this with the voice input, Google autocorrects the text to something like "Pizza Oven" before sending it to my app.

Is there a way to hint, or override auto-correct within my Actions On Google conversation?

1

There are 1 answers

3
Prisoner On

If you are using api.ai, you can specify that you want two of the parameters to be limited to letters and numbers. The @sys.number and @sys.ordinal entities are defined to limit it to numbers, but you will need to create your own @letter entity consisting of, you guessed it, the letters.

In this screen shot, I've created the @letter entity already, and then defined a couple of example phrases. With the prefix "experiment" in this case, it will return the letter and number pair spoken:

letter number intent

If you test this with something like "experiment random", you may see that it still gets matched, but that the parameters are empty. There are a couple of approaches to this. You can require these parameters - but that would mean that you'd be prompted if you didn't enter the pair. Or you can setup an intent with a lower priority that may match more generally. It may look something like this. (The priority can be set by clicking on the colored dot next to the intent name.)

enter image description here

The @sys.any entity is a wildcard, which should match anything. But since this is a lower priority, it will try to match the letter-number pair one first, and then try this one to see if it matches as a fallback.