Browse
 
Tools
Rss Categories

Using the NLU Gateway

Reference Number: AA-02446 Views: 631 0 Rating/ Voters

Usage of the NLU Gateway is done as an added feature of using the  LumenVox Transcription ASR engine.  When activating the transcription engine a simple "dummy" grammar is supplied with a meta tag within the grammar triggering transcription mode.  When also using the gateway,  a further meta tag is supplied to signal which NLU end-point is to be used to do the NLU processing.

In this example, US English transcription will be done on the audio.  The text results will then be sent to the NLU Gateway, using the end-point set up with the name "TravelBot".

<?xml version='1.0'?>
<!-- 
This is a dummy grammar that should not be used for speech recognition.
This should only be used to switch LumenVox licensing to "SLM" mode.
-->
<grammar xml:lang="en-US" version="1.0" root="root" mode="voice"
         xmlns="http://www.w3.org/2001/06/grammar"
         tag-format="semantics/1.0"> 

<meta name="switch_license_typecontent="SLM"/>

<meta name="lv_nlu_gateway_model_idcontent="TravelBot"/>

<rule id="root" scope="public">

<ruleref special="NULL"/>

</rule>
</grammar>


The ASR engine will process the audio, create the transcription text, and then send the text to the NLU service via the NLU Gateway.  The results from the NLU service will be returned in the semantic interpretation portion of the overall results returned by the ASR engine.  This will be in xml format as defined by W3C SISR specification.  However, there is a configuration option available, that will return the results as a JSON formatted string.  This may simplify the task of parsing the NLU results within the speech application's code.


Sample XML style output.

<?xml version='1.0' encoding='ISO-8859-1'?>
<result>
    <interpretation grammar="NLP+NLU.grxml" confidence="99">
        <input mode="speech">ONE TWO THREE FOUR</input>
        <instance>
            <GatewayResults>
                <AgentId>LumenVox_Lex_Account</AgentId>
                <Intents length="3">
                    <item index="0">
                        <confidence>0.49</confidence>
                        <type>BookHotel</type>
                    </item>
                    <item index="1">
                        <confidence>0.38</confidence>
                        <type>BookCar</type>
                    </item>
                    <item index="2">
                        <confidence>0</confidence>
                        <type>AMAZON.FallbackIntent</type>
                    </item>
                </Intents>
                <NextMessage>What city will you be staying in?</NextMessage>
                <SessionId>e0f38ced-3ea0-4d1b-8bb5-7702fd5b6cea</SessionId>
                <Slots length="4">
                    <item index="0">
                        <confidence>1</confidence>
                        <type>CheckInDate</type>
                        <value/>
                    </item>
                    <item index="1">
                        <confidence>1</confidence>
                        <type>Location</type>
                        <value/>
                    </item>
                    <item index="2">
                        <confidence>1</confidence>
                        <type>Nights</type>
                        <value>1234</value>
                    </item>
                    <item index="3">
                        <confidence>1</confidence>
                        <type>RoomType</type>
                        <value/>
                    </item>
                </Slots>
            </GatewayResults>
        </instance>
    </interpretation>
</result>


Sample JSON style output.

<?xml version='1.0' encoding='ISO-8859-1'?>
<result>
    <interpretation grammar="NLP+NLU.grxml" confidence="99">
        <input mode="speech">ONE TWO THREE FOUR</input>
        <instance>
        {
           "GatewayResults" : {
              "AgentId" : "LumenVox_Lex_Account",
              "Intents" : [
                 {
                    "confidence" : 0.49,
                    "type" : "BookHotel"
                 },
                 {
                    "confidence" : 0.38,
                    "type" : "BookCar"
                 },
                 {
                    "confidence" : 0,
                    "type" : "AMAZON.FallbackIntent"
                 }
              ],
              "NextMessage" : "What city will you be staying in?",
              "SessionId" : "b64351b0-290b-405c-a910-92c92223dfed",
              "Slots" : [
                 {
                    "confidence" : 1,
                    "type" : "CheckInDate",
                    "value" : ""
                 },
                 {
                    "confidence" : 1,
                    "type" : "Location",
                    "value" : ""
                 },
                 {
                    "confidence" : 1,
                    "type" : "Nights",
                    "value" : "1234"
                 },
                 {
                    "confidence" : 1,
                    "type" : "RoomType",
                    "value" : ""
                 }
              ]
           }
        }
        </instance>
    </interpretation>