Microsoft Extensions to EMMA

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

This topic presents three schema definitions for Microsoft extensions to EMMA.

WebRecoExtensions.xsd

XML Copy imageCopy Code
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="WebRecoExtensions"
    targetNamespace="http://www.microsoft.com/xmlns/webreco"
    elementFormDefault="qualified"
    xmlns="http://www.microsoft.com/xmlns/webreco"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:emma="http://www.w3.org/2003/04/emma"
>

    <xs:import schemaLocation="http://www.w3.org/TR/2009/REC-emma-20090210/emma.xsd" namespace="http://www.w3.org/2003/04/emma"/>

    <!-- Attribute type for 'ms:actualConfidence' -->
    <xs:simpleType name="actualConfidence">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="-1"/>
            <xs:maxInclusive value="1"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- Attribute type for 'confidencelevel', 'speedvsaccuracy' etc. -->
    <xs:simpleType name="percent">
        <xs:restriction base="xs:decimal">
            <xs:minInclusive value="0.0"/>
            <xs:maxInclusive value="1.0"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- Attribute type for 'timeout', 'completetimeout' etc. -->
    <xs:simpleType name="duration">
        <xs:restriction base="xs:string">
            <xs:pattern value="\+?(([0-9]*\.[0-9]+)|([0-9]+))(s|ms)|(-|\+)?(0+|0*\.0+)(s|ms)?"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- Attribute type for 'dataType' and 'valueType' -->
    <xs:simpleType name="ecmaDataType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="object"/>
            <xs:enumeration value="array"/>
            <xs:enumeration value="string"/>
            <xs:enumeration value="number"/>
            <xs:enumeration value="boolean"/>
            <xs:enumeration value="undefined"/>
            <xs:enumeration value="null"/>
        </xs:restriction>
    </xs:simpleType>
    
    <!-- Type for 'ms:properties' element -->
    <xs:complexType name="properties">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="property"/>
        </xs:choice>
        <xs:attribute name="time" type="xs:dateTime"/>
        <xs:attribute name="status" type="xs:string"/>
        <xs:attribute name="reason" type="xs:integer"/>
        <xs:attribute name="timeout" type="duration"/>
        <xs:attribute name="completetimeout" type="duration"/>
        <xs:attribute name="incompletetimeout" type="duration"/>
        <xs:attribute name="requesttimeout" type="duration"/>
        <xs:attribute name="confidencelevel" type="percent"/>
        <xs:attribute name="sensitivity" type="percent"/>
        <xs:attribute name="speedvsaccuracy" type="percent"/>
        <xs:attribute name="engineproperty" type="xs:string"/>
        <xs:attribute name="maxnbest" type="xs:positiveInteger"/>
        <xs:attribute name="enginerequiredattributes" type="xs:string"/>
        <xs:attribute name="engineoptionalattributes" type="xs:string"/>
    </xs:complexType>

    <!-- Type for 'ms:property' element -->
    <xs:complexType name="property">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string" use="required"/>
    </xs:complexType>

    <!-- Type for 'ms:audio' element -->
    <xs:complexType name="audio" mixed="true">
        <xs:attribute name="type" type="xs:string"/>
        <xs:attribute name="ref" type="xs:anyURI"/>
    </xs:complexType>

    <!-- Type for 'ms:transcript' element -->
    <xs:complexType name="transcript">
        <xs:choice maxOccurs="unbounded">
            <xs:element ref="original"/>
            <xs:element ref="matched-string"/>
            <xs:element ref="error"/>
            <xs:element ref="emma:one-of"/>
            <xs:element ref="emma:interpretation"/>
        </xs:choice>
        <xs:attribute ref="status"/>
    </xs:complexType>

    <!-- Type for 'ms:matched-string' element -->
    <xs:complexType name="matched-string" mixed="true">
        <xs:attribute name="mappingrulelog" type="xs:string"/>
        <xs:attribute name="modificationlevel" type="xs:nonNegativeInteger"/>
    </xs:complexType>


    <!-- Type for 'ms:initial-engine-state' element -->
    <xs:complexType name="initial-engine-state" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:any namespace="##any" processContents="lax"/>
        </xs:choice>
    </xs:complexType>

    <!-- Type for 'ms:active-grammars' element -->
    <xs:complexType name="active-grammars">
        <xs:choice maxOccurs="unbounded">
            <xs:element ref="grammar"/>
        </xs:choice>
    </xs:complexType>

    <!-- Type for 'ms:grammar' element -->
    <xs:complexType name="grammar">
        <xs:attribute name="weight" type="xs:decimal"/>
        <xs:attribute ref="emma:grammar-ref" use="required"/>
    </xs:complexType>

    <!-- Type for 'ms:item' element -->
    <xs:complexType name="item" mixed="true">
        <xs:choice minOccurs ="0" maxOccurs="unbounded">
            <xs:any namespace="##any"/>
        </xs:choice>
        <xs:attribute ref="index"/>
        <xs:attribute ref="dataType"/>
        <xs:attribute ref="valueType"/>
    </xs:complexType>

    <!-- Type for 'ms:sapiPhraseReplacement' element -->
    <xs:complexType name="sapiPhraseReplacement">
        <xs:attribute ref="displayAttributes"/>
    </xs:complexType>

    <!-- Type for 'ms:sapiPhraseElement' element -->
    <xs:complexType name="sapiPhraseElement">
        <xs:attribute ref="displayAttributes"/>
        <xs:attribute ref="pronunciation"/>
        <xs:attribute ref="lexicalForm"/>
        <xs:attribute ref="actualConfidence"/>
    </xs:complexType>

    <!-- Type for 'ms:error' element -->
    <xs:complexType name="error" mixed="true">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:any namespace="##any" processContents="lax"/>
        </xs:choice>
        <xs:anyAttribute namespace="##any" processContents="lax"/>
    </xs:complexType>    

    <!-- Attributes -->
    <xs:attribute name="status" type="xs:string"/>
    <xs:attribute name="dataType" type="xs:string"/>
    <xs:attribute name="valueType" type="xs:string"/>
    <xs:attribute name="typespace" type="xs:string"/>
    <xs:attribute name="actualConfidence" type="actualConfidence"/>
    <xs:attribute name="displayAttributes" type="xs:nonNegativeInteger"/>
    <xs:attribute name="pronunciation" type="xs:string"/>
    <xs:attribute name="lexicalForm" type="xs:string"/>
    <xs:attribute name="index" type="xs:nonNegativeInteger"/>
    <xs:attribute name="length" type="xs:nonNegativeInteger"/>

    <!-- Elements -->
    <xs:element name="properties" type="properties"/>
    <xs:element name="property" type="property"/>
    <xs:element name="audio" type="audio"/>
    <xs:element name="initial-engine-state" type="initial-engine-state"/>
    <xs:element name="transcript" type="transcript"/>
    <xs:element name="original" type="xs:string"/>
    <xs:element name="matched-string" type="matched-string"/>
    <xs:element name="sessionid" type="xs:string"/>
    <xs:element name="requestid" type="xs:string"/>
    <xs:element name="logstring" type="xs:string"/>
    <xs:element name="active-grammars" type="active-grammars"/>
    <xs:element name="grammar" type="grammar"/>
    <xs:element name="error" type="error"/>

</xs:schema>

EmmaWithWebRecoExtension.xsd

XML Copy imageCopy Code
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="EmmaWithWebRecoExtensions"
  targetNamespace="http://www.w3.org/2003/04/emma"
  elementFormDefault="qualified"
  xmlns="http://www.w3.org/2003/04/emma"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:ms="http://www.microsoft.com/xmlns/webreco"
  xmlns:tm="http://www.tellme.com/ns/2009/01/emma"
>
 
  <xs:import schemaLocation="WebRecoExtensions.xsd" namespace="http://www.microsoft.com/xmlns/webreco"/>

  <xs:import schemaLocation="TellMeExtensions.xsd" namespace="http://www.tellme.com/ns/2009/01/emma"/>

  <xs:redefine schemaLocation="http://www.w3.org/TR/2009/REC-emma-20090210/emma.xsd">

    <!-- Add 'ms:status' and 'tm:version' attributes to emma:emma -->
    <xs:complexType name="emma">
      <xs:complexContent>
        <xs:extension base="emma">
          <xs:attribute ref="ms:status" />
          <xs:attribute ref="tm:version" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    
    <!-- Add 'ms:status' attribute to emma:info -->
    <xs:complexType name="info">
      <xs:complexContent>
        <xs:extension base="info">
          <xs:attribute ref="ms:status" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>

    <!-- Add 'tm:name' attribute to emma:grammar  -->
    <xs:complexType name="grammar">
      <xs:complexContent>
        <xs:extension base="grammar">
          <xs:attribute ref="tm:name" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>

    <!-- Add 'ms:dataType' and 'ms:valueType' attributes to emma:literal -->
    <xs:complexType name="literal">
      <xs:complexContent>
        <xs:extension base="literal">
          <xs:attribute ref="ms:dataType" />
          <xs:attribute ref="ms:valueType" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>

    <!-- Add 'ms:typespace' and 'ms:length' attributes to emma:interpretation -->
    <xs:complexType name="interpretation">
      <xs:complexContent>
        <xs:extension base="interpretation">
          <xs:choice>
            <xs:any minOccurs="0" maxOccurs="unbounded" namespace ="##local" processContents="lax"/>
          </xs:choice>
          <xs:attribute ref="ms:typespace" />
          <xs:attribute ref="ms:length" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    
  </xs:redefine>

</xs:schema>

TellMeExtensions.xsd

XML Copy imageCopy Code
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="TellMeExtensions"
  targetNamespace="http://www.tellme.com/ns/2009/01/emma"
  elementFormDefault="qualified"
  xmlns="http://www.tellme.com/ns/2009/01/emma"
  xmlns:mstns="http://www.tellme.com/ns/2009/01/emma"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:attribute name="version" type="xs:string"/>
  <xs:attribute name="name" type="xs:string"/>
</xs:schema>