We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

External Grammar - Get a grammar match, but throw NOMATCH

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jmanzelli
Posts: 1
Joined: Fri Mar 17, 2006 7:07 pm
Contact:

External Grammar - Get a grammar match, but throw NOMATCH

Post by jmanzelli »

I can get field level in-line and external grammars to function correctly, but form or document level external grammars seem to find a match (see log snippet), but throw NOMATCH events. It is probably something I am doing! I have included snippets of the code, the external grammat, and log.

VXML Code:

Code: Select all

<!-- Working Routines are in this form"  --> 
  <form id="basic_grammar_main" scope="document">

    <grammar    version="1.0"
                         xml:lang="en-US"
                         mode="voice"
                         src= "test_grammar.grxml"
                         root="inventory"
                         scope="document"
                         type="application/srgs+xml"  />


      <block>
          <if cond="resultstring == '' ">
                Please list the inventory types of bolts  and nuts  you are interested in searching or  say ALL
          </if>
      </block>

      <initial name="inventory" />

<!-- ..............................   INPUT "FIELDS" BLOCK ................................ -->

<!--   FIELD INPUT - ALL types -->

     <field name="all" />

      <filled namelist="all"  >
        <if cond="all == 'all' ">
          <if cond="all_ctr == faux " >
            <assign name="all" expr="all = 'all' " />
            <assign name="resultstring" expr="resultstring = 'bolts,nuts' " />
            <assign name="all_ctr" expr="all_ctr = veritas" />
            <goto next="#dummy_exit" />
          </if>
        </if>
      </filled>

<!--   FIELD INPUT - Bolts -->
      <field name="bolts" >
        <prompt> Which type of bolts ? </prompt>
      </field>

      <filled namelist="bolt" >
        <if cond="bolts == 'bolts' ">
          <if cond="bolts_ctr == faux " >
             <assign name="bolts" expr="bolt = 'bolts' " />
             <assign name="bolts_ctr" expr="bolts_ctr = veritas" />
             <assign name="resultstring" expr="resultstring = bolts + ',' " />
          </if>
        </if>
       </filled>

<!--   FIELD INPUT - Hex Nuts -->
     <field name="nuts" slot="nuts"  >
        <prompt> Which type of nuts ? </prompt>
      </field>

      <filled namelist="nuts" >
        <if cond="nuts == 'nuts' ">
          <if cond="nuts_ctr == faux " >
            <assign name="nuts" expr="nuts = 'nuts' " />
            <assign name="resultstring" expr="resultstring = resultstring + ',' + nuts" />
            <assign name="nuts_ctr" expr="nuts_ctr = veritas" />
          </if>
        </if>
      </filled>

  </form>



External Grammar:

Code: Select all

<!-- GRAMMAR  COMPONENTS  FOLLOW ....        -->

<!-- Ruleref to utilize the grammar components  -->
      <rule id = "inventory" scope="public" >
         <item repeat = "1-3">
            <one-of>
                <item><ruleref uri="#all"/></item>
                <item><ruleref uri="#bolts"/></item>
                <item><ruleref uri="#nuts"/></item>
            </one-of>
         </item>
       </rule>


<!-- Word = "all" and alternatives  -->
    <rule id="all" scope="public" >
        <item>
           <tag>all="all"</tag>
           <one-of>
              <item xml:lang="en-US" >all</item>
              <item xml:lang="en-US" >everything</item>
              <item xml:lang="en-US" >all of them</item>
           </one-of>
        </item>
    </rule>

<!-- Word = "bolts" and alternatives  -->
    <rule id="bolts" scope="public" >
        <item>
           <tag>bolts="bolts"</tag>
           <one-of>
              <item xml:lang="en-US" >bolts</item>
              <item xml:lang="en-US" >machine screws</item>
              <item xml:lang="en-US" >carriage bolts</item>
           </one-of>
        </item>
    </rule>

<!-- Word = "nuts" and alternatives  -->
    <rule id="nuts" scope="public" >
        <item>
           <tag>nuts="nuts"</tag>
           <one-of>
              <item xml:lang="en-US" >nuts</item>
              <item xml:lang="en-US" >course hex nuts</item>
              <item xml:lang="en-US" >self locking nuts</item>
           </one-of>
        </item>
    </rule>


Log File:
    Finished loading remote grammar from test_grammar.grxml
    VXI::var_element(name="veritas" expr = "")
    VXI::var_element(name="faux" expr = "")
    VXI::var_element(name="undef" expr = "")
    VXI::var_element(name="expression" expr = "")
    VXI::var_element(name="nav2" expr = "")
    VXI::var_element(name="resultstring" expr = "")
    VXI::var_element(name="all_ctr" expr = "")
    VXI::var_element(name="bolts_ctr" expr = "")
    VXI::var_element(name="nut_ctr" expr = "")
    VXI::assign_element(name="veritas" expr = "1==1"
    VXI::assign_element(name="faux" expr = "1==0"
    VXI::assign_element(name="nav2" expr = "' '"
    VXI::assign_element(name="resultstring" expr = " '' "
    VXI::assign_element(name="all_ctr " expr = "faux"
    VXI::assign_element(name="bolts_ctr " expr = "faux"
    VXI::assign_element(name="nut_ctr " expr = "faux"
    bargein set to true
    INPUTMODES set to "VOICE"
    Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
    ---------

    Please list the inventory types of bolts and nuts you are interested in searching or say ALL

    ---------
    VXI::queue_prompts()
    VXI::field_element - activating grammars for form = 'basic_grammar_main' formitem = 'inventory'
    VXI::do_recognition()
    PromptManager::Play()
    Previously playing audio (if any) has finished
    Previously playing audio (if any) has finished
    Newly queued prompts are now being played


    Mon 20 Mar 2006 09:01:10 PM EST:

    Found grammar match
    hypothesis #0: machine screws course hex nuts (0.4100)
    hypothesis #1: machine screws nuts (0.0280)
    Saved utterance 0 for DNIS 3785 on channel 2
    received event: nomatch
    bargein set to true
    INPUTMODES set to "VOICE"
    Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
    ---------
    Sorry, I didn't understand you.
    ---------
    VXI::queue_prompts()
    VXI::field_element - activating grammars for form = 'basic_grammar_main' formitem = 'inventory'
    VXI::do_recognition()
    PromptManager::Play()
    Previously playing audio (if any) has finished
    Previously playing audio (if any) has finished
    Newly queued prompts are now being played


    Mon 20 Mar 2006 09:01:16 PM EST:

    received event: noinput
    VXI::queue_prompts()
    VXI::field_element - activating grammars for form = 'basic_grammar_main' formitem = 'inventory'
    VXI::do_recognition()
    PromptManager::Play()
    Previously playing audio (if any) has finished
    Previously playing audio (if any) has finished


    Mon 20 Mar 2006 09:01:21 PM EST:

    Found grammar match
    hypothesis #0: nuts (0.7430)
    hypothesis #1: all nuts (0.0300)
    Saved utterance 1 for DNIS 3785 on channel 2
    received event: nomatch
    bargein set to true
    INPUTMODES set to "VOICE"
    Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
    ---------
    I still don't understand.
    ---------
    VXI::queue_prompts()
    VXI::field_element - activating grammars for form = 'basic_grammar_main' formitem = 'inventory'
    VXI::do_recognition()
    PromptManager::Play()
    Previously playing audio (if any) has finished
    Previously playing audio (if any) has finished
    Newly queued prompts are now being played


    Mon 20 Mar 2006 09:01:27 PM EST:

    Saved utterance 2 for DNIS 3785 on channel 2
    received event: nomatch
    bargein set to true
    INPUTMODES set to "VOICE"
    Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
    ---------
    Please say it one last time.
    ---------
    VXI::queue_prompts()
    VXI::field_element - activating grammars for form = 'basic_grammar_main' formitem = 'inventory'
    VXI::do_recognition()
    PromptManager::Play()
    Previously playing audio (if any) has finished
    Previously playing audio (if any) has finished
    Newly queued prompts are now being played


    Mon 20 Mar 2006 09:01:32 PM EST:

    Saved utterance 3 for DNIS 3785 on channel 2
    received event: connection.disconnect.hangup
    VXI::exit_element()
    Call End Event
    Ending session
    Ending Session On Channel 2
    plumvp::ChannelThread: Channel 2: Call Terminated
    New session ID 000000;002;1142906492 for Channel 2
    plumvp::ChannelThread: Channel 2: Enabling Call 651
    Enabling Calls For Channel 2
    plumvp::ChannelThread: About to call VXIplatformWaitForCall
    Waiting For Calls on Channel 2

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

specify how IVR tags in ruleref are referenced in top scope

Post by support »

Hello,

The IVR example you are providing is extremely overly complex for what it seems like you are trying to do. Could you provide a simple description of what you are trying to accomplish? The main problem with your IVR code is that the IVR tags are not being returned at all because they are not in the scope of the form. You need to specify how IVR tags within a <ruleref> are referenced in the top scope:

Code: Select all

<rule id = "inventory" scope="public" >
  <item repeat = "1-3">
    <one-of>
      <item><ruleref uri="#all"/><tag>all=all.all</tag></item>
      <item><ruleref uri="#bolts"/><tag>bolts=bolts.bolts</tag></item>
      <item><ruleref uri="#nuts"/><tag>nuts=nuts.nuts</tag></item>
    </one-of>
  </item>
</rule>


However, given what it seems like you are trying to accomplish you would be better served by not using a mixed initiative style form. Mixed initiative forms are rarely the best method for collecting data from the user as they are overly complicated and interactions can be extremely difficult to explain to the end user. If you can provide a brief description of what you are trying to accomplish we can provide guidance on the best approach.

Regards,

Plum Support

Post Reply