E-commerce Lecture 3 Ravi Raman [email protected] CERC, West Virginia University.

19
E-commerce Lecture 3 Ravi Raman [email protected] CERC, West Virginia University

Transcript of E-commerce Lecture 3 Ravi Raman [email protected] CERC, West Virginia University.

Page 1: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

E-commerce Lecture 3

Ravi Raman

[email protected]

CERC, West Virginia University

Page 2: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Sample Code: Tapered Prompts

• <form id="tapered">• <block>• <prompt bargein="false">Welcome to the ice cream

survey.</prompt>• </block>• <field name="flavor">• <grammar>vanilla|chocolate|strawberry</grammar>• <prompt count="1">What is your favorite flavor?</prompt>• <prompt count="3">Say chocolate, vanilla, or

strawberry.</prompt>• <help>Sorry, no help is available.</help>• </field>• </form>

Source: VoiceXML Forum

Page 3: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Contents of Forms

• Form items– Field items– Control items

• Variable declarations (non-field items)

• Event Handlers

• Filled actions

Page 4: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Form Field Items

• Field – value to be obtained using speech or keypad input

• Record – an audio recording of speech input

• Transfer – transfer to another destination

• Object – invoke an external object

• Sub-dialog – invoke a VoiceXML dialog

Page 5: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Variables

• name – name of variable

• expr – optional initial value of variable

• <var name=“customer” expr=“Joe Smith”/>

• <var name=“phone” expr=“8005551234”/>

Page 6: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Assign

• Assigns a value to a variable

• <assign name=“fax” expr=“phone+1”/>

Page 7: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Clear

• Resets one or more form items– Variable is set to undefined– Prompt and event counters for those for items are

reinitialized

• <clear namelist=“name address phone”/>

• Namelist – names of the form items to be reset. Default all form items in current form.

Page 8: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Branching Logic: If, Else, Elseif

• <if cond=“light == ‘red’”>

• <prompt> Stop. </prompt>

• <elseif cond=“light==‘green’”>

• <prompt> Stop. </prompt>

• <else/>

• <prompt> Go FAST </prompt>

• </if>

Page 9: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Conditional Operators

• Must be “escaped”• > “&gt;”• < “&lt;”• >=• <=• &&

• Typical ECMA operators

• != • ==• ||

Page 10: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Grammars

• Speech Grammars

• DTMF Grammars (keypad input)

Page 11: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Speech Grammars

– Specifies speech input and corresponding actions

– Grammar Formats• Java Speech API Grammar Format (JSGF)

– Inline or External File

Page 12: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Speech Grammars

• External File– <grammar src=“http://…” type=“mime-type”/>

• Inline– <grammar> genie </grammar>

– <grammar type=“application/x-jsgf”> • Exit | finished | over | end | stop | done

– </grammar>

Page 13: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Multilingual Phonetics

• The International Phonetic Association

• http://www2.arts.gla.ac.uk/IPA/ipa.html

Page 14: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Menus

• Simple form with one anonymous field

• Prompts user for selection

• Executes action based on user’s choice

Page 15: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Sample Menu

• <menu>• <prompt>Welcome home. Say one of: <enumerate/></prompt>

• <choice next="http://www.sports.org/start.vxml">• Sports </choice>• <choice next="http://www.weather.org/intro.vxml">• Weather </choice>• <choice next="http://www.stargazer.org/astronews.vxml">

• Stargazer astrophysics news </choice>• <noinput>Please say one of <enumerate/></noinput>• </menu>

Page 16: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Menu with DTMF

• <menu dtmf="true">• <prompt>• Welcome home.• <enumerate>• For <value expr="_prompt"/>, press <value

expr="_dtmf"/>.• </enumerate>• </prompt>• <choice next="http://www.sports.org/start.vxml">• sports </choice>• <choice next="http://www.weather.org/intro.vxml">• weather </choice>• <choice next="http://www.stargazer.org/astronews.vxml">• Stargazer astrophysics news </choice>• </menu>

Page 17: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Motorola Development Tools

• www.motorola.com/developers/wireless/tools/– Click on link for Mobile Application Development Kit

– Need to register to download tools (link at bottom of page)

• After registration, – login (enable cookies in browser)– Download and install Motorola IDE using link at top of the

MIX Mobile ADK Download page– Fill in rest of form and download Mobile ADK– Install Motorola IDE before installing the Mobile ADK

Page 18: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

Motorola Demos

• Motorola IDE

• MADK Simulator

Page 19: E-commerce Lecture 3 Ravi Raman rraman@wvu.edu CERC, West Virginia University.

E-commerce Lecture 3

Ravi Raman

[email protected]

CERC, West Virginia University