Browse
 
Tools
Rss Categories

No-Match results due to SI problems

Reference Number: AA-02051 Views: 7850 0 Rating/ Voters

Occasionally, we encounter problems where a grammar being used does not give expected results. There are often a number of reasons for these sorts of problems, but one obscure problem is worth noting, since it can be difficult to identify, but relatively easy to fix.

When performing ASR decodes using either the SpeechPort directly (using our C or C++ APIs) or using our Media Server, the ASR decodes are performed and then the ECMAScript is processed to generate a corresponding Semantic Interpretation (SI) result.

Sometimes, if grammars are not correctly written, the ECMAScript processor can generate an error, which means that although there was a reasonably valid recognition performed, the SI cannot be processed and therefore a full result is not generated, or in the case of using the Media Server, a "no-match" is returned.

A simple example of an ECMAScript problem is shown in the following grammar:

Problematic Grammar:

<?xml version="1.0" encoding="utf-8"?>
<grammar mode="voice" root="rootrule" tag-format="semantics/1.0" version="1.0"
   xml:lang="en-US" xmlns="http://www.w3.org/2001/06/grammar">
   <rule id="rootrule" scope="public">
      <tag> MyChoice=""</tag>
      <one-of>
        <item>one<tag> MyChoice="1"</tag>
        </item>
        <item>two<tag> MyChoice="2"</tag>
        </item>
      </one-of>
      <tag>out=MyChoice;</tag>
   </rule>
</grammar>

  When attempting to use the above grammar, you may see messages like this in your client_asr.txt log file:

05/28/2015 10:11:23.437,ERRO,TIErrorReporter,While interpreting the parse tree created by the grammar http://10.22.22.22/grammars/my_grammar.grxml
Processing rule expansion for $rootrule:
ECMAScript error :
Error: MyChoice is read-only


05/28/2015 10:11:23.437,ERRO,SISRDoInterpret,Failed to produce an output 

This is an ECMAScript error, which is unfortunately a little cryptic, but the root cause of the problem is that the MyChoice variable was not declared with the var statement, which means that anything attempting to use the variable later on, would have problems.

ECMAScript errors differ from grammar syntax issues, since these are parsed at different times. The above grammar, for example, has perfectly valid grammar syntax, meaning that the grammar rules are correct and can be used by the ASR, however when processing of the resulting parse tree is done, the <tag> information containing ECMAScript used for generating the SI may not be correctly formatted, as is the case above. These SI syntax errors are generally difficult to identify before runtime, which is why they can be tricky to identify.

The LumenVox Speech Tuner has a very powerful Grammar Editor built in, which allows grammars to be parsed and the results to be examined closely. We recommend using the Speech Tuner for testing all grammars, and specifically when SI errors such as this are suspected.

The simple solution to this is to declare the MyChoice variable with the var statement, as shown in the corrected grammar below:

Correct Grammar:

<?xml version="1.0" encoding="utf-8"?>
<grammar mode="voice" root="rootrule" tag-format="semantics/1.0" version="1.0"
   xml:lang="en-US" xmlns="http://www.w3.org/2001/06/grammar">
   <rule id="rootrule" scope="public">
      <tag> var MyChoice=""</tag>
      <one-of>
        <item>one<tag> MyChoice="1"</tag>
        </item>
        <item>two<tag> MyChoice="2"</tag>
        </item>
      </one-of>
      <tag>out=MyChoice;</tag>
   </rule>
</grammar>

 ...this grammar can now be used to generate the expected SI output.


*Please note that LumenVox periodically updates the ECMAScript processor used internally by the ASR, so some behaviors may change over time as the ECMAScript specification changes.