Re: multiple values returned

Yahn,

Check out the below code sample, which should illustrate the changes that you will need to make to your existing subgrammar structure. Let me know if I can offer any further help, and I would be happy to do so.

Regards,

Matthew Henry
Voxeo Community Support
Support@voxeo.com

Bring your web applications to the phone.
Find out how at http://community.voxeo.com

===MyMultiSlotSub.gsl ===

MYRULE
[
(MY_HUNDREDS:a ?MY_DENOM:b ?MY_COUNTRY:c) 
{
<choice "filled">
<hun_literal $a.literal> <hun_numeric $a.numeric>
<denom_literal $b.literal> <denom_numeric $b.numeric>
<country_literal $c.literal> <country_numeric $c.numeric>
}
]

MY_HUNDREDS
[
(one hundred)  {return ([<literal "one hundred"> <numeric "100">]) }
(two hundred)  {return ([<literal "two hundred"> <numeric "200">]) }
(three hundred)  {return ([<literal "three hundred"> <numeric "300">]) }
]

MY_DENOM
[
(dollars)  {return ([<literal "dollars"> <numeric "usd">])}
(deutchmarks)  {return ([<literal "deutchmarks"> <numeric "dm">])}
(drakmas)  {return ([<literal "drakmas"> <numeric "ds">])}
]

MY_COUNTRY
[
(united states) {return ([<literal "united states"> <numeric "usa">])}
(germany) {return ([<literal "germany"> <numeric "gm">])}
(greece) {return ([<literal "greece"> <numeric "gc">])}
]


=== ===
<?xml version="1.0"?>
<!DOCTYPE vxml PUBLIC '-//Nuance/DTD VoiceXML 1.0//EN' 
'http://dtd.voxeo.net/dtd/voicexml-nuance-1_2.dtd' >
  <vxml version="2.0">  
    <form id="MyForm">
      <field name="MyField" slot="choice"> 
        <grammar src="MyMultiSlotSub.gsl#MYRULE"/>
        
        <prompt>
          how much money?
        </prompt>

        <nomatch>
          <prompt> 
              enter an amount in hundreds, currency type, and country, such as
              one hundred dollars, united states.
          </prompt>
        </nomatch>

        <filled>
          <prompt>
            You said <value expr="lastResult$.interpretation.hun_literal"/> for the literal amount value, and 
              <value expr="lastResult$.interpretation.hun_numeric"/> for the numeric amount value and
              
              <break size="medium"/>

              <value expr="lastResult$.interpretation.denom_literal"/> for denomination literal
              <value expr="lastResult$.interpretation.denom_numeric"/> for denomination numeric

              <break size="medium"/>

              <value expr="lastResult$.interpretation.country_literal"/> for country literal
              <value expr="lastResult$.interpretation.country_numeric"/> for country numeric

          </prompt>
        </filled>
      </field> 
  </form>
</vxml>



  ----- Original Message ----- 
  From: Yahn Teisseire 
  To: www-voice@w3.org 
  Sent: Wednesday, October 16, 2002 8:42 AM
  Subject: multiple values returned


  Hi,

  I have the following grammar :


  Finalgrammar [
           (Action:a ?Name:n ?Media:m)  {<action $a><contact $n><media $m>}
  ]


  Action [
             call { return ("call")}
             find { return ("find")}
             spell { return ("spell")}
  ]


  Name [
                 [john doe (john doe) johny] {return([<contactname "john doe"><contactid "1234">])}
   ]


  Media [
                 home { return ("home")}
                 mobile { return ("mobile")}
                 work { return ("work")}
             ]



  This grammar works, but i'm unable to access "contactname" and "contactid" :
  application.lastresult$[0].interpretation.action returns "call" for example,
  application.lastresult$[0].interpretation.contact returns { contactname = "john doe" contactid = "1234" },
  but application.lastresult$[0].interpretation.contact.contactname returns "undefined".

  How could i do ?

  Thanks

Received on Wednesday, 16 October 2002 17:34:08 UTC