Home | | Internet & World Wide Web HOW TO PROGRAM | | Internet Programming | | Web Programming | Using Voice Synthesis and Recognition with VoiceXML

Chapter: Internet & World Wide Web HOW TO PROGRAM - Web Accessibility

| Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail |

Using Voice Synthesis and Recognition with VoiceXML

A joint effort by AT&T®, IBM®, Lucent™ and Motorola® has created an XML vocabulary that marks up information for speech synthesizers, which enable computers to speak to users.

Using Voice Synthesis and Recognition with VoiceXML™

 

A joint effort by AT&T®, IBM®, Lucent and Motorola® has created an XML vocabulary that marks up information for speech synthesizers, which enable computers to speak to users. This technology, called VoiceXML, has tremendous implications for people with visual impairments and for the illiterate. VoiceXML-enabled applications read Web pages to the user, and understand words spoken into a microphone through speech recognition technol-ogy. An example of a speech recognition tool is IBM’s ViaVoice (www-4.ibm.com/ software/speech).

 

A VoiceXML interpreter and VoiceXML browser process VoiceXML, a platform-independent XML-based technology. Web browsers may incorporate these interpreters in the future. When a VoiceXML document is loaded, a voice server sends a message to the VoiceXML browser and begins a conversation between the user and the computer.

 

IBM WebSphere Voice Server SDK 1.5 is a VoiceXML interpreter that can be used for testing VoiceXML documents on a desktop computer. To download the VoiceServer SDK, visit www.alphaworks.ibm.com/tech/voiceserversdk. [Note: To run the VoiceXML program in Fig. 34.5, download Java 2 Platform Standard Edition (Java SDK) 1.3 from www.java.sun.com/j2se/1.3. To obtain installation instructions for the VoiceServer SDK and the Java SDK, visit the Deitel & Associates, Inc. Web site at www.deitel.com.]

 

Figures 34.5 and 34.6 show examples of VoiceXML that would be appropriate for a Web site. The document’s text is spoken to the user, and the text embedded in the VoiceXML tags allows for interactivity between the user and the browser. The output included in Fig. 34.6 demonstrates a conversation that might take place between a user and a computer after loading this document.

 

     <?xml version = "1.0"?>

     <vxml version = "1.0">

 

    <!-- Fig. 34.5: main.vxml -->

    <!-- Voice page        -->

 

     <link next = "#home">

     <grammar>home</grammar>

     </link>

       <link next = "#end">

       <grammar>exit</grammar>

       </link>

      <var name = "currentOption" expr = "'home'"/>

       <form>

       <block>

       <emp>Welcome</emp> to the voice page of Deitel and

       Associates. To exit any time say exit.

       To go to the home page any time say home.

       </block>

       <subdialog src = "#home"/>

       </form>

       <menu id = "home">

       <prompt count = "1" timeout = "10s">

       You have just entered the Deitel home page.

       Please make a selection by speaking one of the

       following options:

       <break msecs = "1000" />

       <enumerate/>

       </prompt>

       <prompt count = "2">

       Please say one of the following.

       <break msecs = "1000" />

       <enumerate/>

       </prompt>

       <choice next = "#about">About us</choice>

<choice next = "#directions">Driving directions</choice>

       <choice next = "publications.vxml">Publications</choice>

       </menu>

       <form id = "about">

       <block>

       About Deitel and Associates, Inc.

       Deitel and Associates, Inc. is an internationally

       recognized corporate training and publishing organization,

       specializing in programming languages, Internet and World

       Wide Web technology and object technology education.

       Deitel and Associates, Inc. is a member of the World Wide

       Web Consortium. The company provides courses on Java, C++,

       Visual Basic, C, Internet and World Wide Web programming

       and Object Technology.

       <assign name = "currentOption" expr = "'about'"/>

       <goto next = "#repeat"/>

       </block>

       </form>

       <form id = "directions">

       <block>

       Directions to Deitel and Associates, Inc.

       We are located on Route 20 in Sudbury,

       Massachusetts, equidistant from route

       <sayas class = "digits">128</sayas> and route

       <sayas class = "digits">495</sayas>.

       <assign name = "currentOption" expr = "'directions'"/>

       <goto next = "#repeat"/>

       </block>

       </form>

       <form id = "repeat">

       <field name = "confirm" type = "boolean">

       <prompt>

       To repeat say yes. To go back to home, say no.

</prompt>

<filled>

<if cond = "confirm == true">

<goto expr = "'#' + currentOption"/>

<else/>

<goto next = "#home"/>

       </if>

       </filled>

 

       </field>

       </form>

       <form id = "end">

       <block>

       Thank you for visiting Deitel and Associates voice page.

       Have a nice day.

<exit/>

   </block>

   </form>

          </vxml>

 

Fig. 34.5 Home page written in VoiceXML

 

A VoiceXML document contains a series of dialogs and subdialogs which result in spoken interaction between the user and the computer. The <form> and <menu> tags implement the dialogs. A form element presents information and gathers data from the user. A menu element provides users with options and transfers control to other dialogs, based on users’ selections.

 

Lines 7–9 use element link to create an active link to the home page. Attribute next specifies the URI navigated to when the link is selected. Element grammar marks up the text that the user must speak to select the link. In the link element, we navigate to the ele-ment with id home when users speak the word home. Lines 11–13 use element link to create a link to id end when users speak the word exit.

 

Lines 17–24 create a form dialog using element form, which collects information from the user. Lines 18–22 present introductory text. Element block, which can exist only within a form element, groups elements that perform an action or an event. Element emp states that a section of text should be spoken with emphasis. If the level of emphasis is not specified, then the default level—moderate—is used. Our example uses the default level. [Note: To specify an emphasis level, use the level attribute. This attribute accepts the fol-lowing values: strong, moderate, none and reduced.]

 

        <?xml version = "1.0"?>

<vxml version = "1.0">

<!-- Fig. 34.6: publications.vxml     -->

<!-- Voice page for various publications -->

        <link next = "main.vxml#home">

        <grammar>home</grammar>

        </link>

        <link next = "main.vxml#end">

        <grammar>exit</grammar>

        </link>

        <link next = "#publication">

        <grammar>menu</grammar>

        </link>

      <var name = "currentOption" expr = "'home'"/>

      <menu id = "publication">

        <prompt count = "1" timeout = "12s">

        Following are some of our publications. For more

        information visit our web page at www.deitel.com.

        To repeat the following menu, say menu at any time.

Please select by saying one of the following books:

        <break msecs = "1000" />

        <enumerate/>

        </prompt>

        <prompt count = "2">

        Please select from the following books.

        <break msecs = "1000" />

        <enumerate/>

        </prompt>

        <choice next = "#java">Java.</choice>

        <choice next = "#c">C.</choice>

        <choice next = "#cplus">C plus plus.</choice>

        </menu>

        <form id = "java">

        <block>

        Java How to program, third edition.

        The complete, authoritative introduction to Java.

        Java is revolutionizing software development with

        multimedia-intensive, platform-independent,

        object-oriented code for conventional, Internet,

        Intranet and Extranet-based applets and applications.

        This Third Edition of the world's most widely used

        university-level Java textbook carefully explains

        Java's extraordinary capabilities.

        <assign name = "currentOption" expr = "'java'"/>

        <goto next = "#repeat"/>

        </block>

        </form>

        <form id = "c">

        <block>

        C How to Program, third edition.

        This is the long-awaited, thorough revision to the

        world's best-selling introductory C book! The book's

        powerful "teach by example" approach is based on

        more than 10,000 lines of live code, thoroughly

        explained and illustrated with screen captures showing

        detailed output.World-renowned corporate trainers and

        best-selling authors Harvey and Paul Deitel offer the

        most comprehensive, practical introduction to C ever

        published with hundreds of hands-on exercises, more

        than 250 complete programs written and documented for

        easy learning, and exceptional insight into good

        programming practices, maximizing performance, avoiding

        errors, debugging, and testing. New features include

        thorough introductions to C++, Java, and object-oriented

        programming that build directly on the C skills taught

        in this book; coverage of graphical user interface

        development and C library functions; and many new,

        substantial hands-on projects.For anyone who wants to

        learn C, improve their existing C skills, and understand

how C serves as the foundation for C++, Java, and

       object-oriented development.

       <assign name = "currentOption" expr = "'c'"/>

       <goto next = "#repeat"/>

       </block>

       </form>

184

       <form id = "cplus">

       <block>

       The C++ how to program, second edition.

       With nearly 250,000 sold, Harvey and Paul Deitel's C++

       How to Program is the world's best-selling introduction

       to C++ programming. Now, this classic has been thoroughly

       updated! The new, full-color Third Edition has been

       completely revised to reflect the ANSI C++ standard, add

       powerful new coverage of object analysis and design with

       UML, and give beginning C++ developers even better live

       code examples and real-world projects. The Deitels' C++

       How to Program is the most comprehensive, practical

       introduction to C++ ever published with hundreds of

       hands-on exercises, roughly 250 complete programs written

       and documented for easy learning, and exceptional insight

       into good programming practices, maximizing performance,

       avoiding errors, debugging, and testing. This new Third

       Edition covers every key concept and technique ANSI C++

       developers need to master: control structures, functions,

       arrays, pointers and strings, classes and data

       abstraction, operator overloading, inheritance, virtual

       functions, polymorphism, I/O, templates, exception

       handling, file processing, data structures, and more. It

       also includes a detailed introduction to Standard

       Template Library containers, container adapters,

       algorithms, and iterators.

       <assign name = "currentOption" expr = "'cplus'"/>

       <goto next = "#repeat"/>

       </block>

       </form>

215

       <form id = "repeat">

       <field name = "confirm" type = "boolean">

 

       <prompt>

       To repeat say yes. Say no, to go back to home.

       </prompt>

222

       <filled>

       <if cond = "confirm == true">

       <goto expr = "'#' + currentOption"/>

       <else/>

       <goto next = "#publication"/>

       </if>

       </filled>

       </field>

       </form>

</vxml>

 

Computer:

 

Welcome to the voice page of Deitel and Associates. To exit any time say exit. To go to the home page any time say home.

 

User:

 

Home

 

Computer:

 

You have just entered the Deitel home page. Please make a selection by speaking one of the following options: About us, Driving directions, Publications.

 

User:

 

Driving directions

 

Computer:

 

Directions to Deitel and Associates, Inc. We are located on Route 20 in Sudbury, Massachusetts, equidistant from route 128 and route 495.

To repeat say yes. To go back to home, say no.

 

 

Fig. 34.6 Publication page of Deitel’s VoiceXML page

 

The menu element on line 26 enables users to select the page to which they would like to link. The choice element, which is always part of either a menu or a form, presents the options. The next attribute indicates the page to be loaded when a user makes a selec-tion. The user selects a choice element by speaking the text marked up between the tags into a microphone. In this example, the first and second choice elements on lines 41–42 transfer control to a local dialog (i.e., a location within the same document) when they are selected. The third choice element transfers the user to the document publica-tions.vxml. Lines 27–33 use element prompt to instruct the user to make a selection. Attribute count maintains the number of times a prompt is spoken (i.e., each time a prompt is read, count increments by one). The count attribute transfers control to another prompt once a certain limit has been reached. Attribute timeout specifies how long the program should wait after outputting the prompt for users to respond. In the event that the user does not respond before the timeout period expires, lines 35–39 provide a second, shorter prompt to remind the user to make a selection.

 

When the user chooses the publications option, the publications.vxml (Fig. 34.6) loads into the browser. Lines 106–111 define link elements that provide links to main.vxml. Lines 112–114 provide links to the menu element (lines 118–138), which asks users to select one of the publications: Java, C or C++. The form elements on lines 140–214 describe each of the books on these topics. Once the browser speaks the descrip-tion, control transfers to the form element with an id attribute that has a value equal to repeat (lines 216–231).

 

Figure 34.7 provides a brief description of each VoiceXML tag used in the previous example (Fig. 34.6).

 



 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.