Users of SR plugins:
There are a number of enhancements in the use of SRGS XML grammars, which will be available in upcoming releases of speech recognition plugins. While the changes mostly address issues related to VoiceXML platforms having a limited ability of referencing builtin grammars, some other general use cases are addressed too.
Since many of the cases listed below have already been discussed in other posts, I provide only snippets for each of the case, which would hopefully allow to get an idea what and how is addressed. Otherwise, it would have taken several pages to describe all the cases in greater details.
1) Using speech transcription
Builtin:
builtin:speech/transcribe
SRGS:
<grammar mode="
voice" root="
transcribe" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<rule id="transcribe"> <one-of/> </rule>
</grammar>
2) Using DTMF digits
Builtin:
builtin:dtmf/digits?length=4
builtin:dtmf/digits?minlength=2&maxlength=6
SRGS:
<grammar mode="
dtmf" root="
digits" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<meta name="
minlength" content="
2"/>
<meta name="
maxlength" content="
6"/>
<rule id="digits"> <one-of/> </rule>
</grammar>
<grammar mode="
dtmf" root="
digits
" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<meta name="
length" content="
4"/>
<rule id="digits"> <one-of/> </rule>
</grammar>
3) Setting speech language
Some platforms are not capable of setting the Speech-Language header field in MRCP requests. Now, the language can be set in SRGS,
which has the precedence over other settings. The following SRGS example corresponds to speech transcription using en-AU.
SRGS:
<grammar mode="
voice" root="
transcribe" version="1.0" xml:lang="
en-AU" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<rule id="transcribe"> <one-of/> </rule>
</grammar>
4) Setting Dialogflow project identifier
Builtin:
builtin:speech/transcribe?projectid=your_project_id
SRGS:
<grammar mode="
voice" root="
transcribe" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<meta name="
projectid" content="
your_project_id"/>
<rule id="transcribe"> <one-of/> </rule>
</grammar>
5) Setting Dialogflow session/dialog identifier
Builtin:
builtin:speech/transcribe?dialogid=12345678
SRGS:
<grammar mode="
voice" root="
transcribe" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
builtin"/>
<meta name="
dialogid" content="
12345678"/>
<rule id="transcribe"> <one-of/> </rule>
</grammar>
6) Setting Google speech context based on SRGS.
Speech Context:
<speech-context id="booking" language="en-US">
<phrase>I would like to book a flight from New York to Rome with a ticket eligible for free cancellation</phrase>
<phrase>I would like to book a one-way flight from New York to Rome</phrase>
</speech-context>
SRGS:
<grammar mode="
voice" root="booking" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
hint"/>
<rule id="booking">
<one-of>
<item>
I would like to book a flight from New York to Rome with a ticket eligible for free cancellation</item>
<item>
I would like to book a one-way flight from New York to Rome</item>
</one-of>
</rule>
</grammar>
7) Basic semantic interpretation in SRGS
Starting with the upcoming releases of speech recognition plugins, transcription results will be matched phrases specified in SRGS. Only the <one-of> construct is supported for specifying a list of input phrases. If none of the phrases literally matches the result, then a no-match event is generated. Literal tags are supported as well, if specified as in the following example.
SRGS:
<grammar mode="voice" root="
boolean" version="1.0" xml:lang="en-US" xmlns="
http://www.w3.org/2001/06/grammar">
<meta name="
scope" content="
strict"/>
<rule id="
boolean">
<one-of>
<item>
yes<tag>
true</tag></item>
<item>
sure<tag>
true</tag></item>
<item>
correct<tag>
true</tag></item>
<item>
no<tag>
false</tag></item>
<item>
not sure<tag>
false</tag></item>
<item>
incorrect<tag>
false</tag></item>
</one-of>
</rule>
</grammar>
Questions, suggestions or concerns are welcome.
Thanks.