微软语音识别平台 [英] Microsoft Speech Recognition Platform
问题描述
我写了使用System.Speech语音识别在C#应用程序创建将在Windows 2003的各项(86)相同的应用程序后,但是我的正常工作在Windows 7
I wrote an app in C# for speech recognition using System.Speech which works fine on Windows 7. However I'm after creating the same app that will work on windows 2003 (x86).
我的编程环境:
的Windows 7 64位专业版
的Visual Studio 2008
My programming environment: Windows 7 x64 Pro Visual Studio 2008
为了开发这个在我的编程环境中的应用我安装:
In order to develop this application in my programming environment I installed:
1.Microsoft语音平台 - 服务器运行时(10.1版)(86)
1.Microsoft Speech Platform - Server Runtime (Version 10.1) (x86)
2 。微软语音平台 - 软件开发工具包(SDK)(10.1版)(86)
2.Microsoft Speech Platform - Software Development Kit (SDK) (Version 10.1) (x86)
3.Microsoft语音平台 - 服务器运行时的语言(10.1版)
3.Microsoft Speech Platform - Server Runtime Languages (Version 10.1)
(在这里安装了EN-GB)
(here installed SR for en-GB)
在我的计划,而不是System.Speech我用Microsoft.Speech.Recognition;
In my program instead of System.Speech I used Microsoft.Speech.Recognition;
粘贴从SDK文档代码:
Pasted this code from SDK documentation:
using Microsoft.Speech.Recognition;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Create a new SpeechRecognitionEngine instance.
sre = new SpeechRecognitionEngine();
// Create a simple grammar that recognizes "red", "green", or "blue".
Choices colors = new Choices();
colors.Add("red");
colors.Add("green");
colors.Add("blue");
GrammarBuilder gb = new GrammarBuilder();
gb.Append(colors);
// Create the actual Grammar instance, and then load it into the speech recognizer.
Grammar g = new Grammar(gb);
sre.LoadGrammar(g);
// Register a handler for the SpeechRecognized event.
sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
sre.SetInputToDefaultAudioDevice();
sre.RecognizeAsync(RecognizeMode.Multiple);
}
// Simple handler for the SpeechRecognized event.
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
MessageBox.Show(e.Result.Text);
}
SpeechRecognitionEngine sre;
}
}
我也是在项目属性设置目标平台为x86的。代码编译但一旦我运行或调试它肯定是行不通的。任何想法,我缺少的是什么?
I also set platform target to x86 in project properties. Code compiles but once I run or debug it recognition doesn't work. Any idea what am I missing?
推荐答案
您正在创建一个语音识别引擎,而无需指定一个引擎。既然你已经安装了EN-GB引擎,你需要指定一个的CultureInfo (或 recognizerinfo ):
You're creating a speech recognition engine without specifying an engine. Since you've installed the en-GB engine, you need to specify a cultureinfo (or a recognizerinfo):
sre = new SpeechRecognitionEngine(new CultureInfo("en-GB"));
这篇关于微软语音识别平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!