禁用内置语音识别命令?

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);
        }
    }

}
}

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

本文标题为:禁用内置语音识别命令?

基础教程推荐