禁用内置语音识别命令?

Disable built-in speech recognition commands?(禁用内置语音识别命令?)
本文介绍了禁用内置语音识别命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建能够以自定义方式解释各种文本命令的软件.我使用 System.Speech.Recognition,它的效果出奇地好,但我不知道如何解决这样一个事实,即每当我说删除"、关闭"、更正"等时,我都会以默认值结束Windows (7) 实施.有没有办法通过 System.Speech.Recognition 解决这个问题?如果没有,您最推荐哪个 C# .NET 库?

I'm trying to build software that interprets various textual commands, all in a custom way. I use System.Speech.Recognition and it works surprisingly well, but I can't figure how to get around the fact that whenever I say "Delete", "Close", "Correct", etc, I will end up with the default Windows (7) implementation. Is there any way to get around that with System.Speech.Recognition? If not, which C# .NET library would you recommend the most?

推荐答案

使用 SpeechRecognitionEngine 代替 SpeechRecognizer.
试试这个:

Use SpeechRecognitionEngine instead of SpeechRecognizer.
Try this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Recognition;
namespace speech
{
class Program
{
    static void Main(string[] args)
    {
        SpeechRecognitionEngine mynizer = new SpeechRecognitionEngine();

        GrammarBuilder builder = new GrammarBuilder();
        builder.AppendDictation();
        Grammar mygram = new Grammar(builder);
        mynizer.SetInputToDefaultAudioDevice();
        mynizer.LoadGrammar(mygram);
        while (true)
        {
            Console.WriteLine(mynizer.Recognize().Text);
        }
    }

}
}

这篇关于禁用内置语音识别命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)