代码之家  ›  专栏  ›  技术社区  ›  smoothumut

需要指导语音识别引擎与自定义关键字c#

  •  -1
  • smoothumut  · 技术社区  · 6 年前

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

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

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

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

    提前谢谢。

    2 回复  |  直到 6 年前
        1
  •  1
  •   Michael Levy    6 年前

    Windows桌面版本有用于语音识别的内置api。这些包括语法支持,以确定所说的话或意义。我不知道土耳其语是否受支持。

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

        2
  •  1
  •   Nikolay Shmyrev    6 年前

    https://www.sestek.com 具有良好的土耳其语语音识别能力。至于100个关键词,在这个尺度上,识别整个语音更容易,只需在转录中查找关键词。因为语音识别使用了更多的上下文,所以这会给你更好的准确度。当你只是寻找关键字,你没有上下文,所以识别实际上是不准确的。

        3
  •  0
  •   Programmer    4 年前

    这是C#控制台应用程序的脚本

        4
  •  0
  •   Chris Catignani Sagar Barapatre    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();
                }
            }
        }
    }