Share via


GrammarBuilder.DebugShowPhrases Property

Writes a description of the grammar logic constructed by a GrammarBuilder.

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

Syntax

'Declaration
Public ReadOnly Property DebugShowPhrases As String
public string DebugShowPhrases { get; }
public:
property String^ DebugShowPhrases {
    String^ get ();
}
/** @property */
public String get_DebugShowPhrases ()
public function get DebugShowPhrases () : String

Property Value

Returns a System.String containing a string with an ordered list of phrases and options supported by the current GrammarBuilder.

Example

The example below creates a Grammar emulating a Dictaphone with spelling support.

The Dictaphone features, triggered by the command "start dictation" and terminated by the command "stop dictation", are built with the dictaphoneGBGrammarBuilder instance, this grammar supports the spelling out of words. The spelling is implemented by constructing a GrammarBuilder (spellingGB) which supports recognition of “start spelling” and “stop spelling” commands.

DebugShowPhrases is used to log the status of the final GrammarBuilderinstance used to construct the Grammar.

The output would be of the form: "Dictation=StartDictation=Start Dictation {True} DictationInput=dictation EndDictation=Stop Dictation {False} Spelling=StartSpelling=Start Spelling {True} spellingInput=dictation:spelling StopSpelling=Stop Spelling {True}"

        private void DictaphoneSpellingGrammar(){
    
    GrammarBuilder dictaphoneGB = new GrammarBuilder();
    GrammarBuilder dictation = new GrammarBuilder();
    dictation.AppendDictation();
    
    dictaphoneGB.Append(new SemanticResultKey("StartDictation", new SemanticResultValue("Start Dictation",true)));
    dictaphoneGB.Append(new SemanticResultKey("DictationInput", dictation));
    dictaphoneGB.Append(new SemanticResultKey("EndDictation", new SemanticResultValue("Stop Dictation", false)));

    GrammarBuilder spelling = new GrammarBuilder();
    spelling.AppendDictation("spelling");
    GrammarBuilder spellingGB = new GrammarBuilder();
    spellingGB.Append(new SemanticResultKey("StartSpelling", new SemanticResultValue("Start Spelling",true)));
    spellingGB.Append(new SemanticResultKey("spellingInput", spelling));
    spellingGB.Append(new SemanticResultKey("StopSpelling", new SemanticResultValue("Stop Spelling", true)));

    GrammarBuilder both= GrammarBuilder.Add((GrammarBuilder)new SemanticResultKey("Dictation",dictaphoneGB), 
                                            (GrammarBuilder)new SemanticResultKey("Spelling", spellingGB));
    LogGrammar(both.DebugShowPhrases);
    
    Grammar grammar=new Grammar(both);
    grammar.Enabled=true;
    grammar.Name="Dictaphone and Spelling ";
    _recognizer.LoadGrammar(grammar);
   
}

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

GrammarBuilder Class
GrammarBuilder Members
Microsoft.Speech.Recognition Namespace