Share via


RecognizedPhrase.ConstructSmlFromSemantics Method

Constructs an object containing a valid Semantic Markup Language (SML) based description of the semantics of a Grammar used to obtain the current instance of RecognizedPhrase.

Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)

Syntax

Return Value

Returns an object implementing the IXPathNavigable interface and containing an SML description of the semantics of the Grammar used to obtain the current

Example

In the example below, the SML returned by ConstructSmlFromSemantics is displayed on a WebBrowser control on a user interface.

internal static void DisplaySemanticsSML(WebBrowser browser, RecognizedPhrase result) {
    if (result.Semantics.Confidence == 1.0 && result.Semantics.Count != 0) { //check for valid semantics
        string temporaryFileName = Path.GetTempPath() + "SML.xml";

        FileStream fs = new FileStream(temporaryFileName, FileMode.Create);
        StreamWriter sw = new StreamWriter(fs);
        sw.Write(result.ConstructSmlFromSemantics().CreateNavigator().OuterXml);
        sw.Close();
        //browser.Scale(new SizeF(.9F,.5F)); //To make it look better
        browser.Navigate(temporaryFileName);

    }
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

RecognizedPhrase Class
RecognizedPhrase Members
Microsoft.Speech.Recognition Namespace