Partager via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Comments in .grxml Grammar Files (Microsoft.Speech)

The Microsoft Speech Platform SDK 11 supports grammar files that conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0.

It is an accepted convention to use the .grxml file extension for XML-based grammar documents that conform to the SRGS specification. Comments in .grxml grammar files are enclosed between the string sequences <!-- and -->.

Syntax

<!-- Grammar_rule_description -->

Attributes

None.

Example

<?xml version="1.0" encoding="utf-8"?>
<grammar xml:lang="en-US" root="BlueGreen" tag-format="semantics/1.0" version="1.0" 
xmlns="http://www.w3.org/2001/06/grammar">

<!-- This rule recognizes the color names "blue", "indigo", "azure", "green", --> 
<!-- "teal", and "emerald", and returns the text of the recognized color and --> 
<!-- a semantic value. -->

  <rule id="BlueGreen" scope="public">
    <item>  
      <one-of>
        <item> <ruleref uri="#Blue"/> <tag> out.color=rules.Blue; </tag> </item>
        <item> <ruleref uri="#Green"/> <tag> out.color=rules.Green; </tag> </item>
      </one-of>
    </item>
  </rule>

  <rule id="Blue" scope="public">
    <tag> out="blue"; </tag>
    <one-of>
      <item> blue </item>
      <item> indigo </item>
      <item> azure </item>
    </one-of> 
  </rule>   

  <rule id="Green" scope="public">
    <tag> out="green"; </tag>
    <one-of>
      <item> green </item>
      <item> teal </item>
      <item> emerald </item>
    </one-of> 
  </rule>

</grammar>