2009-03-05 20 views
1

哎呀,大頭銜,但總結這個問題。C#和SAPI,我有語音識別功能,但是它提取的文字我不感興趣。我怎樣才能限制,而不僅僅是重量,格雷默字典?

我在微軟SAPI的C#中使用他們的語音識別在一個程序即時通訊工作。

我所做的是。 grammar = objRecoContext.CreateGrammar(0);

  menuRule = grammar.Rules.Add("typewrite", SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1); 
      object PropValue = ""; 

      menuRule.InitialState.AddWordTransition(null, "will", " ", SpeechGrammarWordType.SGLexical, "will", 1, ref PropValue, 1.0F); 
      menuRule.InitialState.AddWordTransition(null, "New", " ", SpeechGrammarWordType.SGLexical, "New", 1, ref PropValue, 1.0F); 
      menuRule.InitialState.AddWordTransition(null, "Open", " ", SpeechGrammarWordType.SGLexical, "Open", 2, ref PropValue, 1.0F); 
      menuRule.InitialState.AddWordTransition(null, "Close", " ", SpeechGrammarWordType.SGLexical, "Close", 3, ref PropValue, 1.0F); 

用於自定義詞語。 但這會比我想要的更多。我怎樣才能解決這個問題。

我在問的是什麼,我如何讓m $ sapi只關心我想要的單詞。不是默認詞典中的每個詞。

回答

0

您可以嘗試使用命令和控制模式識別器來識別您想要的單詞。 對於您的代碼,所有您需要做的是添加

grammar.CmdSetRuleState(「typewrite」,SpeechRuleState.SGDSActive);

and objRecoContext.State = SpeechRecoContextState.SRCS_Enabled;

希望這會有所幫助..

相關問題