Appends grammar logic to provide access special function free text dictation grammars on the basis of a category string.
Namespace:
System.Speech.Recognition
Assembly:
System.Speech (in System.Speech.dll)
Visual Basic (Declaration)
Public Sub AppendDictation ( _
category As String _
)
Dim instance As GrammarBuilder
Dim category As String
instance.AppendDictation(category)
public void AppendDictation(
string category
)
public:
void AppendDictation(
String^ category
)
public function AppendDictation(
category : String
)
Parameters
- category
- Type: System..::.String
A [System.String] indicating the type of special function dictation grammar to be appended.
Special function dictation grammars are specified within the Speech platform infrastructure with a special URI syntax of the form grammar:dictation#topic.
The category argument supplies value to the #topic file in these URIs.
Currently, only one category is supported: “spelling”.
GrammarBuilder with dictation grammar appended using the AppendDictation(String) method can be freely intermixed without restriction GrammarBuilder instance specifying exact semantics.
Such as GrammarBuilder can be used freely with SemanticResultValue and SemanticResultKey.
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]) instance which has the “spelling” dictation appended to it using the AppendDictation(String), and combining it between to GrammarBuilder instances supporting recognition of “start spelling” and “stop spelling” commands.
The s result will be obtainable from the Value property of SemanticValue instance returned with a recognized phrase and accessed with the tag “spellingInput”.
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(dictaphoneGB, spellingGB);
Grammar grammar=new Grammar(both);
grammar.Enabled=true;
grammar.Name="Dictaphone and Spelling ";
_recognizer.LoadGrammar(grammar);
}
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0
Reference