Upcoming SRGS Enhancements

752 views
Skip to first unread message

Arsen Chaloyan

unread,
Dec 17, 2018, 8:25:19 PM12/17/18
to UniMRCP
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.

--
Arsen Chaloyan
Author of UniMRCP
http://www.unimrcp.org

ankit jobanputra

unread,
Dec 26, 2019, 4:59:57 AM12/26/19
to UniMRCP
Hello,


I am facing issue with loading grammar.
 Unsupported Grammar Format [file:///opt/unimrcp/data/test_grammar] <4e4f543656c14789@gsr>

test_grammar.xml file looks like

<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> Test call</item>
                       <item> demo call</item>

       <one-of>

    </rule>

</grammar>

Sean DiSanti

unread,
Dec 26, 2019, 12:51:53 PM12/26/19
to uni...@googlegroups.com
Ankit, It looks like you're not closing your 'one-of tag' closing instance should be </one-of>

--
You received this message because you are subscribed to the Google Groups "UniMRCP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unimrcp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unimrcp/ce9e93fc-c5ef-4b61-be1a-8109cabd77ca%40googlegroups.com.

ankit jobanputra

unread,
Dec 27, 2019, 12:29:12 AM12/27/19
to UniMRCP
<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> Test call</item>
                       <item> demo call</item>
       </one-of>
    </rule>
</grammar>

chnaged grammar to this even facing the same issue.


2019-12-26 23:26:33:862232 [INFO]   Process RECOGNIZE Request <d9817ed63a9b4aa2@speechrecog> [1]
2019-12-26 23:26:33:862248 [WARN]   Unsupported Grammar Format [file:///opt/unimrcp/data/test_grammar] <d9817ed63a9b4aa2@gsr>
2019-12-26 23:26:33:862252 [WARN]   No Grammar Specified <d9817ed63a9b4aa2@gsr>
2019-12-26 23:26:33:862271 [INFO]   Process RECOGNIZE Response <d9817ed63a9b4aa2@speechrecog> [1]
2019-12-26 23:26:33:862306 [INFO]   Send MRCPv2 Data 172.28.230.128:1544 <-> 172.28.230.128:55272 [125 bytes]
MRCP/2.0 125 1 406 COMPLETE
Channel-Identifier: d9817ed63a9b4aa2@speechrecog
Completion-Cause: 004 grammar-load-failure


2019-12-26 23:26:33:862560 [INFO]   TCP/MRCPv2 Peer Disconnected 172.28.230.128:1544 <-> 172.28.230.128:55272

Sorry, but I dont know why it is not working. Its according to the manual.
To unsubscribe from this group and stop receiving emails from it, send an email to uni...@googlegroups.com.

Doug Rylaarsdam

unread,
Dec 27, 2019, 8:59:42 AM12/27/19
to UniMRCP
Ankit,

The SRGS grammar can be loaded by the SR plugin if sent as the content of the DEFINE-GRAMMAR or RECOGNIZE request (e.g. Content-Type: application/srgs+xml), not as an external reference (e.g. file: or http:). Presuming you are using a VXML client, try specifying your grammar within the <grammar> tag in your document.  Another option, if the grammar doesn't need to be generated dynamically, is to define the speech context in the umsgsr.xml file on the UniMRCP server, and then reference it by name using either a builtin: or a simpler SRGS grammar (this option is section 5.1 in the GSR Manual).

I hope that helps.

Doug
Reply all
Reply to author
Forward
0 new messages