Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Design and Implement a Voice-only Web Application in ASP.NET : Page 5

This whitepaper demonstrates how to use the Microsoft .NET Speech SDK to build a complete e-commerce starter application. Use these detailed techniques to build your own commerce system that will have your customers browsing, shopping, and making purchases using nothing but the sounds of their voices.


advertisement
Common Files: Client-Side Scripting
The globally scoped client-side script files for the application are:

  • Speech.js: NoReco/Silence event handler and object accessors
  • Routines.js: String-formatting routines
  • Debug.js: Client-side debugging utilities
  • CommerceV.js: Global Navigation Event Handlers
  • PromptGenerator.js: Prompt Generation Utility
A few of the more interesting functions of these scripts are outlined below:

HandleNoRecoAndSilence (Speech.js)
HandleNoRecoAndSilence takes care of handling cases where the user repeatedly responds to a prompt with silence or with an unrecognizable input. To avoid frustration, we don't want to repeat the same prompt over and over again. This function, executed each time a QA is made active, counts the number of consecutive times the input is invalid. It increments a counter that the prompt generation utility (see below) uses to generate an appropriate prompt. If the count exceeds a maximum (in this application, three), we redirect the user to a Customer Service Representative.

This function is defined as the OnClientActive event handler for the BaseQAStyle in the GlobalSpeechElement's MainStyleSheet. Each QA that accepts user input must use this style in order for the function to be called correctly.

function HandleNoRecoAndSilence( eventSource, lastCommandOrException, count, semanticItemList) { if (count == 1) PromptGenerator.noRecoOrSilenceCount = 0; if (lastCommandOrException == "Silence" || lastCommandOrException == "NoReco") { PromptGenerator.noRecoOrSilenceCount++; if (PromptGenerator.noRecoOrSilenceCount >= representativeXferCount) Goto(representativeXferPage); } else { PromptGenerator.noRecoOrSilenceCount = 0; } }

Navigator Functions (Speech.js)
The Navigator functions make working with the Navigator application control easier:

  • ActivateNavigator(navigatorName, active):
    In the Speech SDK, speech-controls are activated and deactivated by modifying the semantic state of the control's associated Semantic Item. The same is true for Navigator application controls, though the semantic item is hidden from the user. In order to make activation and deactivation of Navigators simpler, we created a function that sets the Navigator's "ExitSemanticItem" to some dummy value. If the value is empty, the Navigator is activated. If not, the Navigator is inactive.

function ActivateNavigator(navigatorName, active) { var si = eval (navigatorName + "_ExitSemanticItem"); if(active || arguments.length == 1) si.Clear(); else si.SetText("x", true); // value can be anything return active; }

  • GetNavigator(navigatorName): Returns a Navigator object reference given its name as a string.
  • GetNavigatorCount(navigatorName): Returns the count of items in the given navigator.
  • GetNavigatorData(navigatorName, columnName): Returns the data contained in the currently-selected row of the specified navigator's specified column.
  • GetNavigatorQA(navigatorName): Returns a reference to a Navigator's internal QA control.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap