Recognizer INTERPRET

The INTERPRET method, sent from the client to the server, runs semantic interpretation over supplied text rather than live audio. The text is carried in the Interpret-Text header field (which is mandatory), and the result is returned via the INTERPRETATION-COMPLETE event in NLSML format. The result closely resembles the one a RECOGNIZE request would return; only the portions relevant to acoustic matching are omitted.

Grammar data is handled exactly as it is for a RECOGNIZE request.

If a RECOGNIZE or another INTERPRET operation is already in progress on the resource, the server rejects the request with a status-code of 402 ("Method not valid in this state") and a COMPLETE request-state.

Although INTERPRET is defined only in the MRCPv2 specification, Capacity Private Cloud extends support for it to MRCPv1 clients as well, which is useful for clients standardized on the older protocol that still need interpretation-only requests.


MRCPv1 example

An INTERPRET request supplying the text to interpret and an inline grammar, followed by the IN-PROGRESS acknowledgement and the INTERPRETATION-COMPLETE event carrying the NLSML result:

C->S:   INTERPRET 543257 MRCP/1.0
                Interpret-Text:may I speak to Andre Roy
               Content-Type:application/grammar+xml
               Content-Id:request1@form-level.store
               Content-Length:104


             <?xml version="1.0"?>
             <!-- the default grammar language is US English -->
             <grammar xml:lang="en-US" version="1.0">


             <!-- single language attachment to tokens -->
            <rule id="yes">
                      <one-of>
                            <item xml:lang="fr-CA">oui</item>
                            <item xml:lang="en-US">yes</item>
                     </one-of>
           </rule>


          <!-- single language attachment to a rule expansion -->
                 <rule id="request">
                          may I speak to
                         <one-of xml:lang="fr-CA">
                                <item>Michel Tremblay</item>
                               <item>Andre Roy</item>
                       </one-of>
               </rule>


          </grammar>


S->C: MRCP/1.0 543257 200 IN-PROGRESS


S->C: INTERPRETATION-COMPLETE 543257 COMPLETE MRCP/1.0
            Completion-Cause:000 success
           Waveform-URL:http://web.media.com/session123/audio.wav
           Content-Type:application/x-nlsml
           Content-Length:276


          <?xml version="1.0"?>
         <result grammar="session:request1@form-level.store">
                <interpretation>
                     <instance name="Person">
                         <Person>
                             <Name> Andre Roy </Name>
                        </Person>
                    </instance>
            <input> may I speak to Andre Roy </input>
        </interpretation>
</result>

MRCPv2 example

The equivalent exchange in MRCPv2, with the Channel-Identifier header and the application/srgs+xml grammar content type:

C->S:   MRCP/2.0 ... INTERPRET 543266
               Channel-Identifier:32AECB23433801@speechrecog
                Interpret-Text:may I speak to Andre Roy
                Content-Type:application/srgs+xml
                Content-ID:<request1@form-level.store>
                Content-Length:...


               <?xml version="1.0"?>
               <!-- the default grammar language is US English -->
               <grammar xmlns="http://www.w3.org/2001/06/grammar"
                           xml:lang="en-US" version="1.0" root="request">
               <!-- single language attachment to tokens -->
                     <rule id="yes">
                            <one-of>
                                     <item xml:lang="fr-CA">oui</item>
                                    <item xml:lang="en-US">yes</item>
                            </one-of>
                    </rule>


             <!-- single language attachment to a rule expansion -->
                    <rule id="request">
                            may I speak to
                          <one-of xml:lang="fr-CA">
                              <item>Michel Tremblay</item>
                             <item>Andre Roy</item>
                        </one-of>
                 </rule>
          </grammar>


S->C: MRCP/2.0 ... 543266 200 IN-PROGRESS
            Channel-Identifier:32AECB23433801@speechrecog


S->C: MRCP/2.0 ... INTERPRETATION-COMPLETE 543266 200 COMPLETE
             Channel-Identifier:32AECB23433801@speechrecog
              Completion-Cause:000 success
             Content-Type:application/nlsml+xml
             Content-Length:...


<?xml version="1.0"?>
<result grammar="session:request1@form-level.store">
           <interpretation>
                  <instance name="Person">
                         <ex:Person>
                                   <ex:Name> Andre Roy </ex:Name>
                       </ex:Person>
              </instance>
              <input> may I speak to Andre Roy </input>
      </interpretation>
</result>

Related articles


Was this article helpful?