Home > OS >  How do I modify speech contexts in Dialogflow fulfillment
How do I modify speech contexts in Dialogflow fulfillment

Time:03-18

An issue I am seeing is that when I ask in dialogflow for the user to spell out their user id like joesmith2014, there are a large number of errors. The follow post suggested that I can fix this by using speech context to tell the speech to text engine that the user will be spelling out alphanumerics.

https://stackoverflow.com/questions/62048288/dialogflow-regex-alphanumeric-speech

I can't figure out how you would do this while using the actions-on-google library or can this not be down in the fulfillment webhook?

Thanks.

CodePudding user response:

As an example, I created an agent called “alphanumeric” because it will accept any alphanumeric value I send following the next steps:

  1. Check the box regexp entity
  2. Add a single entry, ^[a-zA-Z0-9]{3}[a-zA-Z0-9]*$
  3. Then save it

Your agent should look something like this:

Agent created

Please note that the regexp entity I added is strict in that it is looking only for a string of alphanumerics, without any spaces or dashes. This is important for two reasons:

  1. This regexp follows the auto speech adaptation requirements for enabling the "spelled-out sequence" recognizer mode.

  2. By not looking for spaces and only looking for entire phrases (^...$), you allow end-users to easily exit the sequence recognition. For example, when you prompt "what's your order number" and an end-user replies "no I want to place an order", the regexp will reject and Dialogflow will know to look for another intent that might match that phrase.

If you are only interested in numeric values, you can create a more tailored entity like [0-9]{3}[0-9]*, or even just use the built-in @sys.number-sequence entity.

CodePudding user response:

enter image description here

When testing the agent, make sure that you test it consistently via voice, including the inputs preceding the utterance expected to match a regexp entity.

This tutorial for iterative confirmation of spoken sequences may also help with the agent design.

  • Related