Speech Recognition Grammar Specification

From Wikipedia, the free encyclopedia

Speech Recognition Grammar Specification (SRGS) is an W3C recommendation that defines syntax for representing grammars for use in speech recognition so that developers can specify the words and patterns of words to be listened for by a speech recognizer. There are two main forms of grammars. There is the Augmented BNF format and the XML.

One of the features of the grammar specification is a tag element that can be used to perform post-processing of recognition results to get more semantically rich information than just the words that were spoken. An additional specificiation Semantic Interpretation for Speech Recognition (SISR) defining the use of ECMAScript in these tags is also being developed by the W3C.

[edit] Examples

Here is an example of the Augmented BNF form:

#ABNF 1.0 ISO-8859-1;

// Default grammar language is US English
language en-US;

// Single language attachment to tokens
// Note that "fr-CA" (Canadian French) is applied to only
//  the word "oui" because of precedence rules
$yes = yes | oui!fr-CA;

// Single language attachment to an expansion
$people1 = (Michel Tremblay | André Roy)!fr-CA;

// Handling language-specific pronunciations of the same word
// A capable speech recognizer will listen for Mexican Spanish and
//   US English pronunciations.
$people2 = Jose!en-US; | Jose!es-MX;

/**
 * Multi-lingual input possible
 * @example may I speak to André Roy
 * @example may I speak to Jose
 */
public $request = may I speak to ($people1 | $people2);

Here is an example of the XML from:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd">
 
<grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en-US" version="1.0">
 
  <rule id="yes">
    <one-of>
      <item>yes</item>
      <item xml:lang="fr-CA">oui</item>
    </one-of> 
  </rule> 
  
  <rule id="people1">
    <one-of xml:lang="fr-CA">
      <item>Michel Tremblay</item>
      <item>André Roy</item>
    </one-of>
  </rule>
  
  <rule id="people2">
    <one-of>
      <item xml:lang="en-US">Jose</item>
      <item xml:lang="es-MX">Jose</item>
    </one-of>
  </rule>
  
  <rule id="request" scope="public">
    <example> may I speak with André Roy </example>
    <example> may I speak with Jose </example>
  
    may I speak with
    <one-of>
      <item> <ruleref uri="#people1"/> </item>
      <item> <ruleref uri="#people2"/> </item>
    </one-of>
  </rule>
</grammar>

[edit] See also

[edit] External links