我SpeechRecognitionEngine在我的程序中使用MSDN .问题是它将背景噪声识别为语音.
例如,如果用手指敲击,敲击桌子,或移动我的椅子,它会将其作为语音选择.
为什么在世界上它会将背景噪声识别为语音.
我对齐我的手指听起来不像我说的"记事本"!
这是代码
using System;
using System.Threading;
using System.Speech;
using System.Speech.Synthesis;
using System.Speech.Recognition;
namespace SpeachTest
{
public class MainClass
{
static void Main()
{
MainClass main = new MainClass();
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));
Choices choiceList = new Choices();
choiceList.Add(new string[]{"Open", "Close", "Then", "Volume", "Up", "Firefox", "Notepad", "Steam","turn", "the", "now" } );
GrammarBuilder builder = new GrammarBuilder();
builder.Append(choiceList);
Grammar grammar = new Grammar(new GrammarBuilder(builder,0, 10) );
sre.SpeechRecognized += main.sreRecognizedEvent;
sre.SpeechDetected += main.sreDetectEvent;
sre.SpeechRecognitionRejected += …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Process该类,但每次我都会给出这个编译器错误
当前上下文中不存在名称"进程"
我已经using System.Diagnostics;在我的代码顶部添加了但仍然出现此错误.自动完成甚至不会识别该课程.
听到的是代码.我只包括了Main method因为其余的代码与错误无关.
using System;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
public class MainClass
{
static void Main()
{
AIRuntime adam = new AIRuntime("Adam", false);
adam.AIUpdate();
Process.Start(adam.directory); //adam.directory is just a string
}
}
Run Code Online (Sandbox Code Playgroud)
如果重要,我的IDE是Xamarin Studio.
在Visual Studio上使用Spy ++工具我可以看到像桌面或资源管理器(文件浏览器的东西)这样的窗口接收WM_消息,但像Firefox或Visual Studio这样的窗口不接收消息.
为什么有些人接收消息而其他人没有.
(通过WM_消息,我的意思是,WM_MOUSELEAVE或者WM_SETCURSOR)