本文介绍了已安装的识别器的nullreference的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试为我的项目添加语音识别功能。乌龟演示工作正常;我可以用我的声音控制它。

I'm trying to add speech recognition to my project. The turtle demo works fine; I can control it with my voice.

在我自己的项目中,我正在尝试搜索英语识别器:

In my own project I'm trying to search for the english language recognizer:

string recognizerId = "SR_MS_en-US_Kinect_11.0";
RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers ().Where (r => r.Id == recognizerId).FirstOrDefault ();

导致空引用错误。

我也尝试搜索所有已安装的识别器:

I've also tried searching through all installed recognizers:

foreach (RecognizerInfo recognizerinfo in SpeechRecognitionEngine.InstalledRecognizers()) 
		{
			string value;
			recognizerinfo.AdditionalInfo.TryGetValue("Kinect", out value);
			if("True".Equals(value, StringComparison.OrdinalIgnoreCase) && "en-US".Equals(recognizerinfo.Culture.Name, StringComparison.OrdinalIgnoreCase))
			{
				return recognizerinfo;
			}
		}

同样的错误。我已经检查了我的注册表,它对我来说很好看:  http://puu.sh/gOOyy/9a900bc335.png

Same error. I have checked my registry and it looks fine to me: http://puu.sh/gOOyy/9a900bc335.png

这是我得到的完整错误:

Here's the full error i'm getting:

NullReferenceException: Object reference not set to an instance of an object
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.HKEYfromRegKey (Microsoft.Win32.RegistryKey regKey)
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.RootHKEYFromRegPath (System.String rootPath)
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.Open (System.String registryPath, Boolean fCreateIfNotExist)
Microsoft.Speech.Internal.ObjectTokens.ObjectTokenCategory.Create (System.String sCategoryId)
Microsoft.Speech.Recognition.SpeechRecognitionEngine.InstalledRecognizers ()
SpeechRecognition.GetKinectRecognizer () (at Assets/SpeechRecognition.cs:15)
SpeechRecognition.CreateSpeechRecognizer () (at Assets/SpeechRecognition.cs:31)
SpeechRecognition.InitializeKinect () (at Assets/SpeechRecognition.cs:76)
SpeechRecognition.Start () (at Assets/SpeechRecognition.cs:83)

我有Microsoft Serve Speech Platform Runtime,Microsot Speech安装了平台SDK v11.0和Kinect for Windows语音识别语言包(en-US),不幸的是,我尝试重新安装无济于事。希望有人可以帮助我。

I have the Microsoft Serve Speech Platform Runtime, Microsot Speech platform SDK v11.0 and Kinect for Windows Speech Recognition Language Pack (en-US) installed and I have tried reinstalling to no avail, unfortunately. Hopefully someone can help me.

推荐答案

Speech Platform 11 SDK x86和x64版本,具体取决于您使用的目标二进制格式:

Speech Platform 11 SDK both x86 and x64 versions depending on the target binary format you are using:http://www.microsoft.com/en-us/download/details.aspx?id=27226

Kinect的语音语言包:
http://www.microsoft.com/en-us/download/details.aspx?id=43662

Speech language packs for Kinect: http://www.microsoft.com/en-us/download/details.aspx?id=43662


这篇关于已安装的识别器的nullreference的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 18:31