简体   繁体   English

使用Microsoft System.Speech.Recognition时出现PlatformNotSupportedException

[英]PlatformNotSupportedException while using Microsoft System.Speech.Recognition

I have a one problem in my program. 我的程序有一个问题。 I Want to convert speech to text and I have a this code: 我想将语音转换为文本,我有以下代码:

Choices sList = new Choices();
sList.Add(new string[] { "hello" });
Grammar gr = new Grammar(new GrammarBuilder(sList));
try {
    sRecognize.RequestRecognizerUpdate();
    sRecognize.LoadGrammar(gr);
    sRecognize.SpeechRecognized += sRecognize_SpeechRecognized;
    sRecognize.SetInputToDefaultAudioDevice();
    sRecognize.RecognizeAsync(RecognizeMode.Multiple);
    sRecognize.Recognize();
}
catch (Exception ex) {
    MessageBox.Show(ex.Message.ToString());
}

But when I using it, Visual Studio give an exception "platformnotsupportedexception" And say "The recognizer is not installed." 但是,当我使用它时,Visual Studio给出一个异常“ platformnotsupportedexception”,然后说“未安装识别器”。 I have a microphone, But I don't know why this don't job. 我有麦克风,但我不知道为什么这没用。 Please Help Me. 请帮我。

platformnotsupportedexception The exception that is thrown when a feature does not run on a particular platform. platformnotsupportedexception功能未在特定平台上运行时引发的异常。 This means that you probably didn't install Microsoft Speech Platform SDK 11 Requirements and Installation. 这意味着您可能未安装Microsoft Speech Platform SDK 11要求和安装。 Found here: http://msdn.microsoft.com/en-us/library/hh362873.aspx 在这里找到: http : //msdn.microsoft.com/en-us/library/hh362873.aspx

Are you using System.Speech.Recognition or Microsoft.Speech.Recognition? 您正在使用System.Speech.Recognition还是Microsoft.Speech.Recognition? They're different . 他们不一样 If you're using Speech Platform Runtime/SDK 11, then you need to be using Microsoft.Speech.Recognition. 如果您使用的是Speech Platform Runtime / SDK 11,则需要使用Microsoft.Speech.Recognition。

Also, you probably need to specify a cultureinfo when creating your recognizer . 另外, 在创建识别器时 ,您可能需要指定文化信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM