【问题标题】:need guidance for speech recognition engine with custom keywords c#需要带有自定义关键字的语音识别引擎的指导 c#
【发布时间】:2018-11-07 12:19:31
【问题描述】:

我有一个 Windows 窗体应用程序。我需要在其中添加语音识别,以缩短产品输入的处理时间。我们需要这种土耳其语语音识别。如果是英文,由于发音错误,会产生很多错误的结果。所以我们需要土耳其语。但是windows离线语音识别引擎不支持土耳其语。

实际上,我们需要最多 100 个关键字才能成功。我们不需要整个过程中的语言。因此,如果我可以通过添加一个单词来创建一种语言,并通过一种像 windows 中的语音训练一样的训练来训练引擎,那就太好了。

所以我需要指导来开始或推进这项任务。我看过 cmusphnfix 但它也没有土耳其语。但我不知道是否可以为 100 个单词创建具有正确发音的自定义语言。如果是这样,我怎么能在 c# 中做到这一点。

注意:我们不想使用谷歌和微软的在线服务。我们正在寻找其他选择。

提前致谢。

【问题讨论】:

  • 看起来您在土耳其语语音识别市场上发现了一个空白……但是这种类型的问题与堆栈溢出无关。在这里,我们回答有关异常、语法等代码的具体问题。当任何答案都必须基于意见时,您将如何正确回答任何答案?

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


【解决方案1】:

Windows 桌面版本已内置用于语音识别的 API。这些包括用于识别所说内容的单词或含义的语法支持。我不知道是否支持土耳其语。

也许https://stackoverflow.com/a/5473407/90236https://docs.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh361633(v%3doffice.14) 可以帮助您入门

【讨论】:

    【解决方案2】:

    https://www.sestek.com 具有良好的土耳其语语音识别能力。至于 100 个关键词,在这个规模上更容易识别整个语音,只需在转录中寻找关键词。这将为您提供更好的准确性,因为语音识别使用更多上下文。当您只查找关键字时,您没有上下文,因此识别实际上不太准确。

    【讨论】:

      【解决方案3】:

      这是 C# 控制台应用程序的脚本 如果您希望在 Windows 窗体中使用此功能,只需将静态 void 识别和所有内容复制到此并将其粘贴到 Form 类:Form1 或您想要的位置。写识别();在 button1_click 或您想要的位置。在 windows 窗体中不要复制任何其他内容!

      【讨论】:

        【解决方案4】:

        写这个:

        using System;
        using System.Runtime.CompilerServices;
        using System.Speech.Recognition;
        using System.Speech.Synthesis;
        using System.Threading;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Linq;
        using System.Reflection;
        using System.Text;
        using System.Threading.Tasks;
        using System.Diagnostics;
        using System.Runtime.InteropServices;
        using System.IO;
        using System.Linq.Expressions;
        
        namespace speechrecognition
        {
            class Program
            {
                static string a { get; set; }
        
                static void Main(string[] args)
                {
                     recognize();
                 }
                static void recognize()
                {
                     SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
                    Choices colorChoice = new Choices(new string[] { "gugl", "noutpad" });
                    GrammarBuilder colorElement = new GrammarBuilder(colorChoice);
                    Choices bothChoices = new Choices(new GrammarBuilder[] { colorElement });
                    Grammar grammar = new Grammar((GrammarBuilder)bothChoices);
                    recognizer.LoadGrammar(grammar);
                    try
                    {
                         recognizer.SetInputToDefaultAudioDevice();
                        RecognitionResult result = recognizer.Recognize();
                        try
                        {
                            if (result.Text != null)
                            {
                                 switch (result.Text.ToString())
                                {
                                    // Here you add keywords like other two  
                                    // and write the into choices color choice too
                                    case "noutpad":
                                        Process.Start(@"notepad.exe");
                                        Console.WriteLine("Notepad opened!");
                                        recognize();
                                        break;
                                    case "gugl":
                                        Process.Start(@"chrome.exe");
                                        Console.WriteLine("Google opened!");
                                        recognize();
                                        break;
                                }
                            }
                            else
                            {
                                Console.WriteLine("I dont hear you!");
                                recognize();
                            }
                        }    
                        catch (System.NullReferenceException)
                        {
                            recognize();
                        }
                    }
                    catch (InvalidOperationException exception)
                    {
                        Console.WriteLine("I dont hear you!");
                        Console.ReadLine();
                        recognize();
                    }
                    finally
                    {
                        recognizer.UnloadAllGrammars();
                        recognize();
                    }
                }
            }
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-03-20
          • 1970-01-01
          相关资源
          最近更新 更多