VoiceXML 2.1 Development Guide Home  |  Frameset Home

  Grammar Weighting & Probability  |  TOC  |  Inline GSL Subgrammars  

External GSL Subgrammars

Note: GSL syntax is not considered to be a W3C-compliant syntax for grammars, and the Nuance has discontinued support for GSL grammars in their most recent product offerings. Voxeo will continue to support GSL-specific markup for some time to come, but it is strongly suggested that new applications and their associated grammars leverage the SRGS + SISR grammar syntaxes instead of being reliant upon the deprecated GSL grammar format.

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 VoiceXML 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
MY_MOVIE [
;reference to mid-rule, grammar slot definition, field slot definition
SUB_MOVIE:d {<myMovie $d>}    ]

; mid-level-rule
SUB_MOVIE    (

;optional prefix phrases
?an ?a

; assign results from 'RULE_1' to slot 'a'
RULE_1:a

; assign results from 'RULE_2' to slot 'b'
RULE_2:b

; assign results from 'RULE_3' to slot 'c'
RULE_3:c    )

; concatenate results from slots a, b, and c and return
{return(strcat($a strcat($b $c)))}

; sub-rules, utterance and return values
RULE_1  [
[scary]  {return("scary ")}
[romantic]  {return("romantic ")}
[action packed]  {return("action packed ")}
    ]

RULE_2    [
[zombie]  {return("zombie ")}
[cop]  {return("cop ")}
[cartoon]  {return("cartoon ")}
    ]

RULE_3    [
[comedy]  {return("comedy ")}
[drama]  {return("drama ")}
[thriller]  {return("thriller ")}
]



SubGrammarFile.vxml


<?xml version="1.0"?>
<vxml version="2.0">

  <form id="MainMenu">
    <field name="Pick_Movie">
      <prompt>
        Welcome to Bob's House of Un watchable movies.
        Please pick a movie that you'd never, ever want to watch.
      </prompt>
      <grammar src="MySubG.grammar#MY_MOVIE" type="text/gsl"/>

      <filled namelist="MyName">
        <prompt>
          You chose to watch a <value expr="lastresult$.interpretation.myMovie"/> movie.
        </prompt>
      </filled>
    </field>

  </form>
</vxml>


Download the Code!

  Download the source code




  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Grammar Weighting & Probability  |  TOC  |  Inline GSL Subgrammars  

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