C# 使用SpeechLib DLL的语音到文本未触发识别事件
这是我的代码,我不熟悉SpeechLib Dll,我参考了一个网站,我只是尝试了一下 我已经使用System.speech命名空间完成了语音到文本应用程序。但是在那里我无法获得100%的准确度,所以我只是在尝试可用的可能性C# 使用SpeechLib DLL的语音到文本未触发识别事件,c#,speech-recognition,C#,Speech Recognition,这是我的代码,我不熟悉SpeechLib Dll,我参考了一个网站,我只是尝试了一下 我已经使用System.speech命名空间完成了语音到文本应用程序。但是在那里我无法获得100%的准确度,所以我只是在尝试可用的可能性 static void Main(string[] args) { wavRecoContext = new SpInProcRecoContext(); ((SpInProcRecoContext)wavRecoContext
static void Main(string[] args)
{
wavRecoContext = new SpInProcRecoContext();
((SpInProcRecoContext)wavRecoContext).Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(Program_Recognition);
((SpInProcRecoContext)wavRecoContext).Hypothesis += new _ISpeechRecoContextEvents_HypothesisEventHandler(Program_Hypothesis);
((SpInProcRecoContext)wavRecoContext).EndStream += new _ISpeechRecoContextEvents_EndStreamEventHandler(Program_EndStream);
grammar = wavRecoContext.CreateGrammar(0);
grammar.DictationLoad("", SpeechLoadOption.SLOStatic);
inputFileStream = new SpFileStream();
inputFileStream.Open("aboutus.wav", SpeechStreamFileMode.SSFMOpenForRead, false);
wavRecoContext.Recognizer.AudioInputStream = inputFileStream;
grammar.DictationSetState(SpeechRuleState.SGDSActive);
Console.ReadKey();
}
static void Program_Hypothesis(int StreamNumber, object StreamPosition, ISpeechRecoResult Result)
{
throw new NotImplementedException();
}
static void Program_EndStream(int StreamNumber, object StreamPosition, bool StreamReleased)
{
grammar.DictationSetState(SpeechRuleState.SGDSInactive);
}
static void Program_Recognition(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult Result)
{
Console.WriteLine(Result.PhraseInfo.GetText(0, -1, true));
}
}
我不知道我在这里犯了什么错误。
如果有人对此问题有经验,请给我解决方案。您没有选择SR引擎。进程内reco上下文需要指定音频源和识别引擎
我有一些,但我还没有把它翻译成C#/SpeechLib 如何在项目引用中添加SpeechLib?它是一个COM,但不显示在COM列表中。