W3C home > Mailing lists > Public > www-voice@w3.org > April to June 2002

please hep built-in grammar

From: yanyang fang <f_yanyang@hotmail.com>
Date: Wed, 15 May 2002 12:28:05 -0400 (EDT)
To: www-voice@w3.org
Message-ID: <F88uBeZVo2d3gwhDCvY0001bbaa@hotmail.com>

Hello everyone,



I am using JSGF grammar format to develop a grammar which allows user to 
transfer amount of money from one account to another account, the grammar I 
write so far only works “transfer from a account to another account”, it can 
not specify the amount of money as I am not able to add built in grammar 
such as “currency” into grammar file. The SDK I am using is IBM SDK 2.0, the 
error message says: “Unknown import builtin.grammar in fromtogrammar”. Can 
anybody help me to sort this problem? Thank you very much in advance for any 
idea.

Here is the code:

Grammar file:fromtogrammar.gram

#JSGF V1.0;

grammar fromtogrammar;

import <builtin.grammar.digits>;

public <fromto> =

[from]<fromaccount>{this.fromaccount=$}[to][<toaccount>{this.toaccount=$}][please];

public <fromaccount>= saving | current;

public <toaccount>= saving | current;

public <amount>=<digits>;


here is the file that use the grammar : transfer.vxml
<?xml version="1.0"?>

<vxml version="1.0">

<form id="accounttransfer">

<grammar src="fromtogrammar.gram" type="application/x-jsgf"/>

<initial name="start">

  <prompt> what accounts would you like to transfer from and to?</prompt>

  <help> you can say, for example, from current to saving account.

  </help>

    <nomatch count="1"> I'm sorry, I don't understand.

        I will ask you for information one piece at a time.

    <assign name="start" expr="true"/></nomatch>

</initial>

<field name="toaccount">

  <prompt>please state the account name to which you want to 
transfer</prompt>

<grammar src="fromtogrammar.gram#toaccount"/>

   <catch event="nomatch"> sorry, please say your valide account 
name</catch>

   <filled>

   <if cond="toaccount==fromaccount">

      <clear namelist="toaccount"/>

      sorry, can not transfer between two same account, please try 
agin<reprompt/>

   </if>

   </filled>

   </field>

<field name="fromaccount">

  <prompt>please state the account name from which you want to 
transfer</prompt>

<grammar src="fromtogrammar.gram#fromaccount"/>

<catch event="nomatch"> sorry, please say your valid account name</catch>

   <filled>

   <if cond="toaccount==fromaccount">

      <clear namelist="frmaccount"/>

      sorry, can not transfer between two same account, please try 
again<reprompt/>

   </if>

   </filled>

  </field>

<field name="amount" type="digits">

<prompt>how much money you would like to transfer?</prompt>

  <help>for example, you can say or key in 100 pounds.</help>

</field>

<field name="go_ahead" type="boolean" modal="true">

  <prompt>Do you want to transfer <value expr="amount"/>from

    <value expr="fromaccount"/>to<value expr="toaccount"/>?

  </prompt>

  <filled>

     <if cond="go_ahead">

        <prompt>thank you very much for your interesting</prompt>

      <!--<submit next="http://localhost:8080/servlet/bankservlet.transfer" 
namelist="fromaccount toaccount amount"/>-->

     </if>

     <clear namelist="fromaccount toaccount start amount go_ahead"/>

  </filled>

</field>

</form>

</vxml>



Thanks a lot



Yanyang









_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com
Received on Wednesday, 15 May 2002 17:46:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 30 October 2006 12:48:55 GMT