VoiceXML2.0规范 第二章 Dialog的结构

第二章  Dialog的结构 [第一章 ][前一章 ][后一章 ]
 
第一节 Forms 第二节   第三节   第四节   第五节
 
    form是VoiceXML文档的主要组成部分,它包括以下几个部分:
      1、一组form item,即在FIA(form interpretation algorithm)的主循环被访问的一些元素。Form item可细分为input item和control item,input item可由用户填充,而control item不能;
      2、非form item(non-form item)变量的声明;
      3、事件处理;
      4、填充后(filled)的操作,也就是当某些input item的组合被赋值后要执行的程序逻辑模块。
    Form元素的属性:
idForm的名字。如果有指定的话,这个form就可以在该文档内被引用,或者在别的文档中引用它。例如,<form id="weather">,<goto next="#weather">。
scope该form语法的默认作用域(scope)。如果它的值为dialog,则该form语法只是在这个form里是激活的;如果它的值为document,则该form语法在这个文档的任何对话中都是激活的;如果该文档为应用根文档,则该form语法在这个应用的任何文档的任何dialog中都是激活的。注意,单独的form的语法作用域的优先权高于默认的语法作用域。例如在非根文档的某个form默认的作用域为dialog,且有一个form语法的作用域为document,则该语法在这个文档的任何对话中都是激活的。
表3:<form>元素的属性
    这一节描述了关于form的一些概念,并给出了它们的一些操作的具体例子。
 
一、Form的解释
    form由内置的FIA解释。FIA有一个主循环用来重复选定一个form item并访问它。被选定的form item是在文档顺序中第一个警戒条件不满足的form item。例如,field的默认警戒条件检测看该field的form item变量是否有值。因此,如果一个简单的form只包含了几个field,则每个field会顺序地提示给用户。
    解释一个form item一般包括以下步骤:
      1、选定并播放一个或多个prompt;
      2、收集用户的输入,或填充一个或多个input item的响应,或一些事件的抛出(例如help);
      3、解释属于最新的input item的填充的<filled>操作。
    FIA终止于解释一个控制语句的跳转(例如用<goto>元素到另一个对话或文档,或者一个<submit>元素把数据提交到文档服务器)。当再没有符合条件的form item可以被选定时,FIA也随着一个隐式的<exit>而中止。
    关于FIA更详细的说明见2.1.6节。
 
二、Form Items
    form item就是在FIA的主循环中能够被访问的元素。Input item控制FIA为特定的元素收集信息。当FIA选定一个control item时,该control item可以包含一个要执行的代码块,或告诉FIA开始为混合主动式的form的提示和收集进行初始化。
 
    <一>、Input Items
    input item指定了得到用户输入的input item变量。它有一些提示,告诉用户要说或者键入什么;还有定义允许的输入的语法;还有处理一些由此产生的事件的事件处理。Input item也可以有<filled>元素,它定义了input item变量被填充以后要进行的操作。Input item有以下几个:
<field>它的值是通过ASR或DTMF语法获得的。
<record>它的值是用户录音的一段音频。例如,<record>元素可以用来收集语音邮件的语音信息。
<transfer>它把用户转接到另一个电话号码。如果该转接返回控制,则把该转接结果的状态赋值给它的变量。
<object>它通过一些参数调用依赖于平台的object,该object是一个ECMAScript Object。平台的object可以是一个内置的dialog,比如说用来收集信用卡信息的dialog。也可以是用特定的DTMF文本方法收集文本消息的dialog。虽然当依赖于平台的object不被平台支持时,要抛出error.unsupported.objectname事件来处理<object>元素(专门的事件变量“_message”提供了更详细的错误信息,详见5.2.2节),但是对于这些依赖于平台的object的执行却是没有任何限制的。
<subdialog><subdialog>有点像函数调用。它调用同一文档中的另一个dialog,或者调用另一个文档。它返回的是一个ECMAScript Object。
表4:Input Items
 
    <二>、Control Items
    control item有两种:
<block>它包含一些程序语句的序列,这些程序语句是用于提示和计算的,不是用于收集输入的。<block>有一个form item变量(通常是隐含的),在它被解释之前,该变量被置为true。
<initial>该元素用于在混合主动式的form里控制最初的交互。它应该提示用户说一些话来匹配一个form级别的语法。在<initial>元素的执行中,当至少有一个input item变量被识别结果所填充时,<initial>元素的form item变量变为true,从而把它置为不是FIA可选定的。
表5:Control Items
 
三、Form Item变量和条件
    每个form item都有一个和它相关的form item变量,当进入该form时,它的默认值为undefined。Input item的form item变量包含了解释该form item的结果。Input item的form item变量也称为input item变量(Input item variable),它保存了从用户那里收集到的值。Input item变量可以用name属性给它命名;或让它匿名,此时会产生一个内部名称。
    每个form item也有一个警戒条件,它决定该form item是否能够被FIA选定。默认的警戒条件只是检测该form item是否有非undefined的值,如果有,该form item就不会被访问。
    通常,input item都会有名称,control item都没有名称;form item变量都没有被赋初始值,且没有指定附加的警戒条件。但有些时候需要更精确地控制。如:form可以在开始的时候给一个form item 变量赋初始值来跳过相应的field的执行,然后清零(如用<clear>元素)并强制该field重新被选定;另一个field可以有一个警戒条件,只有当该field没有被选定过,且其他两个field已经被填充时才激活它;或只有当某个条件为true时,<block>才能执行。这样一来,哪些form item会被FIA选定并执行的顺序可以得到更好的控制。然而,通常很多对话都可以不用这么复杂。
    总的来说,所有的form item都有如下的属性:
name该form item变量的名称,作用域为dialog。它保存了该form item的值。
expr给form item变量赋初始值,默认的初始值为ECMAScript 的undefined 。如果有初始值,则该form item不会被执行,除非该form item变量被清零。
cond它是一个表达式的值,如果缺省,默认值为true。如果是在<initial>元素里,它用来检测是否有input item被填充了。
表6:Form Item共有的属性
 
四、Directed Forms
    最简单、最普通的form类型是,在computer-directed交互中,该form的form item正好被顺序地执行一次。
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="weather_info">
         <block>Welcome to the weather information service.</block>
         <field name="state">
           <prompt>What state?</prompt>
           <grammar src="state.grxml"  type="application/srgs+xml"/>
           <catch event="help">
              Please speak the state for which you want the weather.
           </catch>
         </field>
         <field name="city">
           <prompt>What city?</prompt>
           <grammar src="city.grxml" type="application/srgs+xml"/>
           <catch event="help">
              Please speak the city for which you want the weather.
           </catch>
         </field>
         <block>
           <submit next="/servlet/weather" namelist="city state"/>
         </block>
        </form>
      </vxml>
    该对话执行的顺序为:
      C (computer): Welcome to the weather information service. What state?
      H (human): Help.
      C: Please speak the state for which you want the weather.
      H: Georgia.
      C: What city?
      H: Tblisi.
      C: I did not understand what you said. What city?
      H: Macon.
      C: The conditions in Macon Georgia are sunny and clear at 11 AM ...
    FIA的第一次循环选定时,选定了第一个block,因为它的form item变量(隐含的)值为undefined。该block输出了它的提示语,且它的form item变量被置为true。在FIA的第二次反复选定时,略过了第一个block,因为它的form item变量值不为undefined,此时FIA选定了名为“state”的field,因为该field的变量state的值为undefined。该field提示用户输入州名,然后把变量state置为用户输入的答案。关于field级的语法填充form item变量的具体描述见3.1.6节。第三次提示并收集名称为city的field。第四次执行了最后的block,并跳转到另外一个URI。
    这个例子里的每个field都有播放一段提示语引导用户输入,有一个语法指定要监听的内容,有help事件的事件处理。无论何时,只要用户要求帮助,help事件就会被抛出。Help事件处理捕获这些事件并播放一段更详细的提示语。
    下面还有一个机器主导的form,用于收集信用卡信息的:
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="get_card_info">
         <block>We now need your credit card type, number, and expiration date.</block>
         <field name="card_type">
           <prompt count="1">What kind of credit card do you have?</prompt>
           <prompt count="2">Type of card?</prompt>
           <!-- This is an inline grammar. -->
           <grammar type="application/srgs+xml" root="r2" version="1.0">
             <rule id="r2" scope="public">
              <one-of>
               <item>visa</item>
               <item>master<item repeat="0-1">card</item></item>
               <item>amex</item>
               <item>american express</item>
              </one-of>
            </rule>
          </grammar>
          <help>Please say Visa, Mastercard, or American Express.</help>
          </field>
          <field name="card_num">
           <grammar type="application/srgs+xml" src="/grammars/digits.grxml"/>
           <prompt count="1">What is your card number?</prompt>
           <prompt count="2">Card number?</prompt>
           <catch event="help">
             <if cond="card_type =='amex' || card_type =='american express'">
               Please say or key in your 15 digit card number.
          <else/>
               Please say or key in your 16 digit card number.
          </if>
         </catch>
          <filled>
           <if cond="(card_type == 'amex' || card_type =='american express') && card_num.length != 15">
               American Express card numbers must have 15 digits.
             <clear namelist="card_num"/>
             <elseif cond="card_type != 'amex'&& card_type !='american express'&& card_num.length != 16"/>
               Mastercard and Visa card numbers have 16 digits.
             <clear namelist="card_num"/>
             <throw event="nomatch"/>
           </if>
          </filled>
        </field>
        
        <field name="expiry_date">
          <grammar type="application/srgs+xml" src="/grammars/digits.grxml"/>
          <prompt count="1">What is your card's expiration date?</prompt>
          <prompt count="2">Expiration date?</prompt>
          <help>
             Say or key in the expiration date, for example one two oh one.
          <filled>
            <!-- validate the mmyy -->
            <var name="mm"/>
            <var name="i" expr="expiry_date.length"/>
            <if cond="i == 3">
              <assign name="mm" expr="expiry_date.substring(0,1)"/>
            <elseif cond="i == 4"/>
              <assign name="mm" expr="expiry_date.substring(0,2)"/>
            </if>
            <if cond="mm == '' || mm < 1 || mm > 12">
             <clear namelist="expiry_date"/>
             <throw event="nomatch"/>
            </if>
          </filled>
         </field>
         
         <field name="confirm">
           <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
           <prompt>
              I have <value expr="card_type"/> number
             <value expr="card_num"/&> expiring on
             <value expr="expiry_date"/>.
              Is this correct?
           </prompt>
           <filled>
             <if cond="confirm">
               <submit next="place_order.asp" namelist="card_type card_num expiry_date"/>
             </if>
             <clear namelist="card_type card_num expiry_date confirm"/>
           </filled>
         </field>
        </form>
      </vxml>
    注意:语法的可选项‘amex’和‘american express’返回的真实值需要在条件表达式中分开处理。3.1.5节描述了语法中的语义元素怎样才能对多种输入返回一个单独的值。
    该对话的流程可能是这样的:
      C: We now need your credit card type, number, and expiration date.
      C: What kind of credit card do you have?
      H: Discover.
      C: I did not understand what you said. (a platform-specific default message.) 
      C: Type of card? (the second prompt is used now.)
      H: Shoot. (fortunately treated as "help" by this platform)
      C: Please say Visa, Master card, or American Express.
      H: Uh, Amex. (this platform ignores "uh") 
      C: What is your card number?
      H: One two three four ... wait ...
      C: I did not understand what you said.
      C: Card number?
      H: (uses DTMF) 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 #
      C: What is your card's expiration date?
      H: one two oh one
      C: I have Amex number 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 expiring on 1 2 0 1. Is this correct?
      H: Yes.
    Field是form的主要组成元素。Field声明了一个变量并指定了相应的提示语、语法、DTMF序列、帮助信息和其他一些事件处理。每个field声明了一个VoiceXML form item变量,它的作用域为该form的dialog。该field被填充后,它的变量可以被提交,也可以赋值给其他的变量。
    每个field有它自己的语音和(或)DTMF语法,既可以明确的使用<grammar>元素指定,也可以用type属性隐含地指定。Type属性用于指定内置的语法,像digits、boolean或number。
    每个field可以有一个或多个提示语。如果有一个提示语,它会被反复地播放给用户,直到用户输入信息。若有多个提示语则根据提示语选择算法来选定提示语(详见4.1.6节)。在每次要播放提示语的时候,count属性可以决定用哪一条提示语。在这个例子,提示语越变越短,这叫做锥形提示(tapered prompting:语音提示渐渐地简短而精炼,或越来越精细)。
    <catch event="help">元素是一个事件处理,它定义了当用户请求帮助时该做什么。帮助信息也可以是分级的。这些信息可以简化,下面两个元素的效果是等同的。
      <catch event="help">
         Please say visa, mastercard, or amex.
      </catch>
       
      <help>
         Please say visa, mastercard, or amex.
      </help>
    <filled>元素定义的是,当用户提供了相应field要识别的输入后该做什么。一个用途就是在语法检查之后再指定一套完整的约束,像上面例子中名为expiry_date的field。
 
五、Mixed Initiative Forms
    上一节我们讨论了执行严格的,由计算机主导的会话,要实现混合主动式的form,即计算机和用户共同主导该会话,必须有一个或多个form级别的语法。这种会话的编写有几种方式,其中一种普遍的方式是使用<initial>元素和<field>元素,<initial>元素用来获得全面的信息,而<field>元素用来获得特定的信息。下面的例子说明了这一点。其他一些更复杂的技巧也可以取得同样的效果,例如使用<initial>元素的cond属性。
    如果某个form拥有几个form级别的语法,那么:
      1、它的input item在任何顺序中都能够被填充;
      2、用户的一个utterance就可以填充一个以上的input item。
    只有input item能够被form级别的语法的匹配结果填充,control item不能。关于form级别的语法填充field变量的描述见3.1.6节。
    当用户在其他的对话内,form级别的语法也可能是激活的。假如某个文档有两个form,一个是汽车租金的form,另一个是酒店预定的form,它们都有在整个文档激活的语法,在和酒店预定的form交互的时候,用户可以输入汽车租金的信息,引导计算机到汽车租金的form里。用户可以根据任何激活的语法讲话,填充input item和进行相应的操作。
    例子 。下面的例子是天气信息服务的第二个版本,是混合主动式的。这个例子为了增强它的说明性,加入了广告和城市名及州名的确认:
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="weather_info">
         <grammar src="cityandstate.grxml" type="application/srgs+xml"/>
         <!-- Caller can't barge in on today's advertisement. -->
         <block>
           <prompt bargein="false">
             Welcome to the weather information service.
             <audio src="http://www.online-ads.example.com/wis.wav"/>
           </prompt>
          </block>
         
         <initial name="start">
           <prompt>
              For what city and state would you like the weather?
           </prompt>
           <help>
             Please say the name of the city and state for which you would like a weather report.
          </help>
          <!-- If user is silent, reprompt once, then try directed prompts. -->
          <noinput count="1"><reprompt/></noinput>
          <noinput count="2"><reprompt/><assign name="start" expr="true"/></noinput>
         </initial>
           
         <field name="state">
           <prompt>What state?</prompt>
             <help>
               Please speak the state for which you want the weather.
            </help>
         </field>
         
         <field name="city">
           <prompt>Please say the city in <value expr="state"/>for which you want the weather.</prompt>
           <help>Please speak the city for which you want the weather.</help>
           <filled>
             <!-- Most of our customers are in LA. -->
             <if cond="city == 'Los Angeles' && state == undefined">
               <assign name="state" expr="'California'"/>
             </if>
           </filled>
         </field>
        
        <field name="go_ahead" modal="true">
          <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
          <prompt>Do you want to hear the weather for <value expr="city"/>, <value expr="state"/>?</prompt>
          <filled>
            <if cond="go_ahead">
              <prompt bargein="false">
                <audio src="http://www.online-ads.example.com/wis2.wav"/>
             </prompt>
             <submit next="/servlet/weather" namelist="city state"/>
            </if>
            <clear namelist="start city state go_ahead"/>
           </filled>
         </field>
        </form>
      </vxml>
    下面是该例子的一个可能的流程,它显示了它的优势,即使该用户是个新手:
      C: Welcome to the weather information service. Buy Joe's Spicy Shrimp Sauce.
      C: For what city and state would you like the weather?
      H: Uh, California.
      C: Please say the city in California for which you want the weather.
      H: San Francisco, please.
      C: Do you want to hear the weather for San Francisco, California?
      H: No
      C: For what city and state would you like the weather?
      H: Los Angeles.
      C: Do you want to hear the weather for Los Angeles, California?
      H: Yes
      C: Don't forget, buy Joe's Spicy Shrimp Sauce tonight!
      C: Mostly sunny today with highs in the 80s. Lows tonight from the low 60s ...
    名称为go_ahead的field有一个modal属性,它的值为true,它的作用是使所有的语法都失效,除了当前form item中定义的那个语法,因此,在该field中只有boolean语法是激活的。
    有经验的用户可以更快的完成流程,但是他还是必须要听广告:
      C: Welcome to the weather information service. Buy Joe's Spicy Shrimp Sauce.
      C: What ...
      H (barging in): LA.
      C: Do you ...
      H (barging in): Yes.
      C: Don't forget, buy Joe's Spicy Shrimp Sauce tonight!
      C: Mostly sunny today with highs in the 80s. Lows tonight from the low 60s ...
    Controlling the order of field collection.
    FIA可以用多种方式定制。其中一种方法是给一个form item变量赋值,这样该form item就不会被选定了;另一种方法是用<clear>把form item变量置为undefined,强制FIA再次访问该form item。
    还有一种是用<goto>元素的nextitem属性明确地指定下一个要访问的form item,该方法强加了一个到目标form item 的立即跳转。目标form item的变量、条件和计数器都不会被重置。即使该form item已经被访问过,他的提示语还是会播放的。如果<goto nextitem>跳转出现在<filled>中,该<filled>剩下的操作和任何挂起的<filled>操作都会被跳过。
    下面这个例子中<goto nextitem>出现在exit事件的事件处理中:
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="survey_2000_03_30">
           <catch event="exit">
             <reprompt/>
             <goto nextitem="confirm_exit"/>
           </catch>
           <block>
             <prompt>
                Hello, you have been called at random to answer questions critical to U.S. foreign policy.
             </prompt>
           </block>
           
           <field name="q1">
             <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
             <prompt>Do you agree with the IMF position on privatizing
                 certain functions of Burkina Faso's agriculture ministry?</prompt>
          </field>
          
          <field name="q2">
           <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
             <prompt>If this privatization occurs, will its effects be
                  beneficial mainly to Ouagadougou and Bobo-Dioulasso?</prompt>
         </field>
         
          <field name="q3">
           <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
             <prompt>Do you agree that sorghum and millet output might
                   thereby increase by as much as four percent per annum?</prompt>
         </field>
         
         <block>
           <submit next="register" namelist="q1 q2 q3"/>
         </block>
         
        <field name="confirm_exit">
           <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/>
           <prompt>You have elected to exit.  Are you sure you want to do this, and perhaps 
             adversely affect U.S. foreign policy vis-a-vis sub-Saharan Africa for decades 
             to come?</prompt>
        
         <filled>
           <if cond="confirm_exit">
             Okay, but the U.S. State Department is displeased.
             <exit/>
            <else/>
             Good, let's pick up where we left off.
             <clear namelist="confirm_exit"/>
            </if>
          </filled>
          <catch event="noinput nomatch">
            <throw event="exit"/>
          </catch>
         </field>
        </form>
      </vxml>
    无论用户在哪个要收集的问题中说“exit”,平台都会抛出exit事件,并由<catch>元素的事件处理捕获。该事件处理把FIA引导到下一个要访问的field,“confirm_exit”。confirm_exit域在正常的调查完成过程中将不再被访问,因为其前面的<block>元素将控制转向“register”脚本。
 
六、Form Interpretation Algorithm
    我们已经从概念上讨论了FIA,在这一节,我们将更详细地讨论它(更详细的描述见附录C)。
 
    <一>、Initialization Phase
    FIA只要进入一个form就会初始化它。内部的提示语计数器变量(在form的dialog作用域内)被置为1。每个变量(form级别的<var>元素和form item变量)根据在文档中的顺序被一一初始化为undefined和相应的expr属性的值。
 
    <二>、Main Loop
    FIA的主循环有三个阶段:
    选定(select)阶段:选定下一个没有被填充的form item供访问。
    收集(collect)阶段:访问被选定的form item,播放它的提示语让用户输入,激活相应的语法,等待收集用户的输入(例如语音或DTMF按键输入)或者事件(例如请求帮助或noinput timeout)。
    处理(process)阶段:处理用户输入,填充form item并执行<filled>元素的操作,例如确认输入;处理事件,执行该事件相应的事件处理。
    注意:FIA可以被给定一个输入(一组语法槽值(grammar slot/slot value pairs)),该输入是用户在另外一个FIA时被收集到的。在这种情况下,主循环的第一次循环跳过了选定和收集阶段,直接跳到处理阶段,使用给定的输入处理。另一个要注意的是,如果在选定或收集阶段有错误发生,产生一个事件,该事件被抛出,FIA也直接跳到处理阶段。
 
      1、Select phase
      选定阶段的目的是选定下一个要访问的form item,当出现以下情况时,选定阶段结束:
      如果上一次主循环的处理阶段指定了一个<goto nextitem>,则该指定的form item被选定。
      另外,如果第一个form item的警戒条件为false,则该form item被选定。在检查警戒条件时,如果发生错误,事件被抛出,FIA跳过收集阶段,进入处理阶段,处理该事件。
      如果没有任何form item的警戒条件为false,且FIA最后一次循环完成时没有碰到明确的控制跳转,FIA会执行一个隐含的<exit>操作(类似的,如果执行是在form 之外,例如当在form之外产生一个错误时,没有任何明确的控制跳转,解释器将执行一个隐含的<exit>操作)。
 
      2、Collect phase
      收集阶段的目的是收集用户输入或事件。当一个form item被选定时,FIA要执行的操作取决于该form item的类型:
      如果访问的是一个field item,FIA根据该field item的提示语计数器和提示语条件选定提示语,进行排队,然后激活并监听该field级别的语法和任何其他更高级别的激活的语法,等待语法识别和某个事件。
      如果访问的是<transfer>,FIA根据提示语计数器和提示语条件对提示语进行排队,激活该item的语法,在该transfer执行前播放它的提示语队列。
      如果访问的是<subdialog>或<object>,FIA根据提示语计数器和提示语条件对提示语进行排队,FIA没有激活语法,相反,执行环境给subdialog或object指定了收集输入的行为。在执行subdialog或object之前不播放提示语队列,而应该在后来的输入收集的时候播放。
      如果访问的是<initial>,FIA根据该<initial>的提示语计数器和提示语条件选定提示语,进行排队,然后监听form级别的语法和其他更高级别的激活的语法,等待语法识别和某个事件。
      如果访问的是<block>,FIA把它的form item 变量置为true,对它的内容求值,跳过处理阶段,没有收集任何输入,FIA主循环的下一次循环进入该<block>。
 
      3、Process phase
      处理阶段的目的是处理上一个阶段收集到的输入或事件。
        (1)、如果出现一个事件(如noinput或挂机),FIA确定该应用的catch元素并执行它,该应用catch元素在当前form item 的范围内选定,在该会话封装的范围内进行,这样可能会导致该FIA终止(例如,如果它跳转到一个对话或文档,或执行了<exit>),或者可能导致FIA进入主循环的下一个循环(如,执行帮助的默认事件处理)。
        (2)、如果某个输入匹配了<link>语法,则FIA执行该link的跳转,或者抛出它的事件,如果<link>抛出一个事件,事件在当前的form item(如<initial>、 <field>、<transfer>等等)的环境下处理。
        (3)、如果输入匹配了一个不同于当前form的另一个form的语法,该FIA终止,另一个form被初始化,该form的FIA带着这个输入直接进入它的处理阶段。
      如果某个输入匹配了该form的语法,则:
        (1)、该语法的语义结果被映射到一个或多个form item变量,详细描述见3.1.6节;
        (2)、FIA标识这些赋值所触发的<filled>操作,详细描述见24节;
        (3)、FIA根据它们在文档中的顺序执行每个<filled>操作。如果遇到<submit>、<disconnect>、<exit>、<return>、<goto>或者<throw>元素,就不会再执行剩下的<filled>元素了,FIA要么终止,要么继续主循环的下一个循环。<reprompt>不会终止FIA(终止意味着一个操作),只是相当于给相应的prompt做个标记,让FIA在下一次循环再次播放prompt。如果在执行某个<filled>时抛出一个事件,FIA将在该<filled>的作用域内开始选定事件处理,该作用域可以是一个 form item或者该form自己,然后在该dialog作用域外处理。
      在完成处理阶段后,解释器继续返回到选定阶段。
    关于FIA更详细的描述见附录C。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值