VoiceXML 2.1 Development Guide Home  |  Frameset Home

  Multislot GSL Grammars  |  TOC  |  External GSL Subgrammars  

GSL Grammar Weighting

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.

Chances are, if you have spent time writing a grammar with moderate amounts of utterances, you will likely want to tweak your files for maximum accuracy. The best place to start is by logging utterance/confidence scores, (or even recording the entire call), to see what utterances your callers are using the most frequently, and what utterances are getting mis-recognized. From this, we can 'second guess' future callers' responses, and adjust our grammars accordingly.

Tweaking Grammar Weight

Unmodified grammar entries each have the same probability of a match, which works fine in some cases. But any grammar that is used in a 'real-world' application needs a scientific attention to this detail for maximum efficiency. With relative ease, we can override the default confidence score, (1.0), of a particular utterance, and assign it a specific likelihood of a match. Let's take a simple test case, where we have a grammar that has a smidge of ambiguity that expects utterances that sound marginally similar. Our test application is attempting to discern the caller's choice of city (Springfield) which in this case can be in just about any state in the US. For our contrived example we also assume that there might be a "Springfield, Tanzania":


WeightingDialog.xml

<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"
    xmlns:voxeo="http://community.voxeo.com/xmlns/vxml">
    <form>
    <field name="">
      <grammar src="WeightedGrammar.gsl#CITY_STATE" type="text/gsl"/>
      <!-- caller should say "springfield" -->
      <prompt>
      what city are you looking for?
      </prompt>

      <filled>
      <prompt>
        looks like you were looking for<value expr="lastresult$.interpretation.CityState"/>
      </prompt>
      <log expr="'*** UTTERANCE = ' + lastresult$.utterance"/>
      <log expr="'*** INTERPRETATION = ' + lastresult$.interpretation.CityState"/>
      <log expr="'*** CONFIDENCE = ' + lastresult$.confidence"/>
      </filled>
    </field>
    </form>
</vxml>



Grammar.gsl

CITY_STATE [
(springfield ?tanzania)                  {<CityState "Springfield Tanzania">}
(springfield ?pennsylvania)              {<CityState "Springfield Pennsylvania">}
(springfield ?missouri)                  {<CityState "Springfield Missouri">}
]





As we have but a few to choose from, and they are all somewhat similar in name, it's easy to see how we could get a few mis-recognitions. So, we add some inline grammar scores to skew the outcome in favor of statistics with the following command syntax:


RULENAME [
(utterance) ~.00                          {<slotname "interpretation">}
]


Pretty easy, eh? The only real things to keep in mind that a score of '.3', or '.30', means that there is a thirty percent chance that this will be the choice that a given user will select. A score of '.1' would probably be assigned to a less popular choice, and a score of '1.0' or higher would be the most likely choice within a particular grammar rule.

You can also add the Kleene and Positive closure operators to the grammar for an additional degree of tuning, as illustrated below:


  • Positive Closure Operator
  •   (+brains are yummy)
    The phrase following the '+' operator can be repeated numerous times and fire off the match. Thus, 'brains are yummy' and 'brains brains brains are yummy' will both be considered successful matches.

  • Kleene Closure Operator
  •   (*human brains are yummy)
    The phrase following the '*' can be repeated infinitely, or not at all. Thus, 'human brains are yummy' ,  or 'brains are yummy'  will all be considered successful matches.

    So, let's look at our sample file now that it's been modified with explicit probability scoring for the utterances:

    WeightedGrammar.gsl

    CITY_STATE [
    (springfield ?tanzania)~.05                  {<CityState "Springfield Tanzania">}
    (springfield ?pennsylvania)~1.9              {<CityState "Springfield Pennsylvania">}
    (springfield ?missouri)~.02                  {<CityState "Springfield Missouri">}
    ]


    Given the (marginal) ambiguity between "Springfield Tanzania", and "Springfield Pennsylvania", and also given the fact that the probability score that we gave for the latter entry is much higher than the one we gave for the former entry, it is a safe bet that any caller utterance of "springfield" will actually return a result of "Springfield Pennsylvania", which is as designed.

    Again, it is very important that any weighting applied to grammars is only done after careful analysis of utterance/confidence/interpretation result data from *live*  caller interactions in the real world, and not based upon lab testing done with a very small subset of testers.

    Download the Code!

      Download the source code






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

    login
      Multislot GSL Grammars  |  TOC  |  External GSL Subgrammars  

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