【问题标题】:Does anyone know why C# Speech recognition suddenly doesnt work anymore?有谁知道为什么 C# 语音识别突然不再起作用了?
【发布时间】:2020-07-30 01:46:52
【问题描述】:

几天前,我想制作一个可以识别语音并将其转换为文本的应用程序。我需要很长时间才能运行 System.Speech.Recognition。我遇到了很多被质疑并总是以另一种方式回答的问题。没有一个对我有用。最后我得到了它的工作。

今天我启动了这个程序,它运行良好。它可以听到我的声音并认出我说的话。但大约 3 小时后它完全停止工作。我当时所做的只是拔下耳机并再次插入。我没有改变代码。我什至没有重新启动 Visual Studio。它仍然从以前开始运行。我现在也重新启动了计算机,但没有任何成功。我完全不知道发生了什么。我收到一条不会导致错误的消息(搜索此消息对我没有任何帮助):“信息:0:SAPI 未实现拼音字母选择。”

我知道这不是很多信息,如果您需要一些我没有提到的信息,请询问。谁能帮我解决这个问题?

代码如下:

        using (recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("de-DE")))
        {

            // Create and load a dictation grammar.
            Choices services = new Choices(new string[] { "rennen", "laufen", "schleichen", "renn", "lauf", "schleich", "jetzt", "kiste", "Generator", "Stop", "Halt", "Warte", "rechts", "links", "Rückwärts", "hinten" });

            // Create a Grammar object from the GrammarBuilder and load it to the recognizer.
            Grammar servicesGrammar = new Grammar(services);
            recognizer.LoadGrammarAsync(servicesGrammar);

            // Configure input to the speech recognizer.
            recognizer.SetInputToDefaultAudioDevice();
            

            recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
            recognizer.RecognizeAsync(RecognizeMode.Multiple);

            // Keep the console window open.
            while (true)
            {
                Thread.Sleep(5);
            }

        }

    public void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
        //Nothing Important here, because it never reaches that point
    }

【问题讨论】:

  • 如果它使用在线服务,则某些端口/IP 可能被关闭/禁止。
  • 据我了解,它不使用在线服务。我正在使用内部语音识别。我还检查了控制面板-> 语音识别是否有效。确实如此。

标签: c# speech-recognition speech-to-text speech


【解决方案1】:

对于遇到相同问题的每个人:对不起,我无法回答您是如何再次工作的。它突然又工作了,没有任何变化......非常奇怪的行为

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-07
    • 2012-07-16
    • 1970-01-01
    • 2015-07-06
    • 2019-01-12
    • 2021-01-27
    • 2011-09-29
    • 2011-05-22
    相关资源
    最近更新 更多