Export (0) Print
Expand All

Testing SRGS 1.0 Grammars With Tellme Studio

This topic gives you the basic VoiceXML files you need and instructions for testing your grammar in a simple application.

Ee800144.note(en-us,MSDN.10).gifImportant:
To do the testing with the Tellme Platform, you need to be a developer member of the Tellme Studio: Go to http://studio.tellme.com and click the Join Studio button. Fill out the required information in the Become a Tellme Studio Developer form and click the Submit button. Credentials for using Studio online and by phone are then e-mailed to you.

This topic includes the following sections:

This simple VoiceXML application can be used to test any grammar that returns a single string to the application. The string is automatically placed in the result variable, and the application repeats it to the caller in the <filled> section.

<?xml version="1.0"?>
<VXML version="2.1" revision="4"
      xmlns="http://www.w3.org/2001/06/grammar"
      xml:lang="en-US">
<form id="mainDialog">
   <field name="result">
      <prompt>please say something</prompt>

      <!-- YOUR GRAMMAR GOES HERE-->

      <filled>
         <log>raw result is <value expr="result"/></log>
         <prompt> thank you </prompt>
         <prompt>you said <value expr="result"/> </prompt>
      </filled>
      <noinput> </noinput>
      <nomatch> </nomatch>
   </field>
</form>
</VXML>

You can log the result variable using the <log> tag and then view the log. This is an excellent way to verify that your grammar is returning what you want it to return. In the test application above, the statement <log>raw result is <value expr="result"/></log> writes the value of result (which is where the application puts the grammar match, if any) to the log. You can then open the log (see Troubleshooting) to see the value.

Using the log in this fashion is the best way to see exactly what the grammar match was.

This VoiceXML application is the same as the previous one (Test application for grammars returning a single string), except that:

  • The grammar returned a number of different match values, as properties of a result Object.
  • The <filled> section repeats each variable back to the caller.
<?xml version="1.0"?>
<VXML version="2.1" revision="4" xmlns="http://www/w3/org/2001/VXML" xml:lang="en-US">

<form  id="mainDialog">
   <field name="resultObject">
      <prompt>Please say something</prompt>


      <!-- YOUR GRAMMAR GOES HERE-->

      <filled>
         <prompt>thank you</prompt>
         <prompt>
            result object dot property one is <value expr="resultObject.property1"/>
         </prompt>
         <prompt>
            result object dot property two is <value expr="resultObject.property2"/>
         </prompt>

         <prompt>
            result object dot property three is <value expr="resultObject.property3"/>
         </prompt>

         <prompt>
            result object dot property four is <value expr="resultObject.property4"/>
         </prompt>
         <prompt>
            <!-- AND SO FORTH....-->
         </prompt>

      </filled>
      <noinput> </noinput>
      <nomatch> </nomatch>
   </field>
</form>
</VXML>

Testing grammars that return multiple values

If your grammar returns a single string, it is easy to use the <log> tags to send the grammar match results to the log file. If, on the other hand, your grammar returns an object, you need one <log> statement for each of the object’s properties. It is often preferable to convert the object’s properties to a single string so that it can be logged more easily. The following JavaScript code does such a conversion.

var result = "";
for (var propi in object) {
   result += object + "." + propi + "=" + object[propi] + "^";
}

This code steps through the object’s properties (propi) one at a time and constructs a string of the form:

result = "object.property1=value1^object.property2=value2^..."

Running the test
  1. Copy the appropriate one of the two preceding applications and paste it into an XML editor of your choice.

  2. Add your grammar or grammars and save the composite application file.

  3. Open a browser and go to http://studio.tellme.com

  4. Log in and click the Scratchpad item in the left-hand menu to open the Scratchpad.

    Ee800144.2adec23c-69ba-4c93-ac31-bb488eb2e72a(en-us,MSDN.10).gif

    Ee800144.note(en-us,MSDN.10).gifImportant:
    You must be using the Microsoft speech engine to test your SRGS grammar. Click the edit my preferences button in Scratchpad's button bar. In the Tellme Preferences window, check the Use MS Speech Engine box and then click the Submit button. The next time you open Scratchpad, you should see the correct SRGS grammar testing phone number.
  5. Copy your application and paste it into the Scratchpad window.

    Ee800144.ea25185f-8e0c-45af-bab8-e9f95a8c3b60(en-us,MSDN.10).gif

  6. Click the orange Update button.

    Ee800144.3f68a962-fbfe-4c1d-ab7d-97faed33803a(en-us,MSDN.10).gif

    This causes your application to compile. Any errors found in the VoiceXML are displayed in the upper portion of the Scratchpad window.

    Ee800144.5932f1cb-353a-4c11-b563-dbae60c58132(en-us,MSDN.10).gif

    Ee800144.note(en-us,MSDN.10).gifImportant:
    Clicking the Update button checks the VoiceXML code for errors. It does not check the grammar syntax beyond validating the grammar as XML.
  7. Call the phone number listed at the top of the Scratchpad window and respond to the "please say something" prompt with the language your grammar expects. If your application has no errors, the match values of your utterances are spoken back to you.

    Ee800144.note(en-us,MSDN.10).gifTip:
    Plan to always use the same phone when calling Tellme to test an application. Studio offers to remember the number you are calling from so you do not have to log in on subsequent calls.

Troubleshooting

If you call Tellme to test a VoiceXML application that you pasted into Scratchpad and you get no response, there are errors in your application. You can use the debug log to learn what they are:

Viewing the log
  1. Click the debug log button in the upper left of the Studio window.

    Ee800144.38f4f4c8-3d31-4e23-b18c-3e0cbb955231(en-us,MSDN.10).gif

    A window opens that lists the available debug logs, with the latest listed first

    Ee800144.ef4306db-cb64-4d86-b759-6123f4ee4a24(en-us,MSDN.10).gif

  2. Click View Log for the most recent log.

    The debug log that opens should help you find the errors. They are shown in red.

    Ee800144.8cce9aa0-4be3-42f7-9739-9e9bd2160f55(en-us,MSDN.10).gif

    Ee800144.note(en-us,MSDN.10).gifNote:
    There are no critical errors in this log. The one error in red shows that the VoiceXML application does not terminate correctly, but that is immaterial because the test of your code is completed prior to termination.
Show:
© 2014 Microsoft