VoiceXML 2.1 Development GuideHome  |  Frameset Home

  Grammar Weighting & Probability  |  TOC  |  Inline GSL Subgrammars  

External GSL Subgrammars

Multi-level grammars can drastically improve compilation time and recognition accuracy for large grammar structures. Subgrammars simply involve a multiple rulename grammar construct which concatenates all filled slot results and then returns them to the vxml application. (Our subgrammar tutorial covers the construction of these grammars step by step). The syntax for a subgrammar construct uses some slightly new syntax for slot assignation than the usual 'flat-file' grammars, which the following code illustrates:

MySubG.grammar

;top level rulename
MYRULE [   
NAME:d {<MyName $d>}    ]
; sub-rule
NAME    (
; assign results from 'FIRSTNAME' to slot 'a'
FIRSTNAME:a
; assign results from 'MIDDLENAME' to slot 'b'
MIDDLENAME:b
; assign results from 'LASTNAME' to slot 'c'
LASTNAME:c    )
; concatenate results from slots a, b, and c and return
{return(strcat($a strcat($b $c)))}

FIRSTNAME    [
[matthew] {return("matthew ")}
    ]

MIDDLENAME    [
[warren]  {return("warren ")}
    ]

LASTNAME    [
[henry]  {return("henry ")}
    ]



SubGrammarFile.vxml

<?xml version="1.0"?>
<vxml version="2.0">
 
  <form id="MainMenu">
    <field name="MyName">
      <prompt>
        Please say your first, middle, and last name.
      </prompt>
      <grammar src="MySubG.grammar#MYRULE" type="text/gsl"/>

      <filled namelist="MyName">
        <prompt>
          You said <value expr="MyName$.interpretation.MyName"/>
        </prompt>
      </filled>
    </field>

  </form>
</vxml>

 


  ANNOTATIONS: EXISTING POSTS
vanvoice
12/27/2003 4:59 AM (EST)
The "]" located after NAME:d {<MyName $d>} ,

should it be there? or maybe "[" is missing?
MattHenry
12/27/2003 11:37 AM (EST)
Leon,

That's a typo, i'll see that it gets fixed.

~Matt

login
  Grammar Weighting & Probability  |  TOC  |  Inline GSL Subgrammars  

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site