c# - 我收到错误“未安装识别模块”C# .Net 4.8 System.Speech.Recognition
问题描述
我正在尝试制作一个聊天机器人。我正在使用可以在“C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\Speech.dll”中找到的 Speech.dll
我成功实现了 Text-To-Speech,但现在我必须添加 Speech-To-Text,但它不起作用。我在代码的很多部分(如 loadGrammarAsync 或 SetInputToDefaultAudioDevice())上收到错误“未安装识别模块”。我遵循了很多教程,甚至是微软官方教程,但我无法摆脱这个错误。
我在某处读到需要安装 Microsoft Speech SDK,但在任何地方都找不到,当我点击 SDK 的 microsoft 页面上的链接时,我收到错误 404。
https://www.youtube.com/watch?v=AB9lfHDOe5U&t=0s
这是 Speech-To-Text 的代码:
static void listenTest()
{
// Create an in-process speech recognizer for the en-US locale.
using (SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine())
{
try
{
// Create and load a dictation grammar.
recognizer.LoadGrammar(new DictationGrammar());
}
catch(Exception e)
{
Console.WriteLine("\n" + e);
}
// Add a handler for the speech recognized event.
recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
// Configure input to the speech recognizer.
recognizer.SetInputToDefaultAudioDevice();
// Start asynchronous, continuous speech recognition.
recognizer.RecognizeAsync(RecognizeMode.Multiple);
// Keep the console window open.
while (true)
{
Console.ReadLine();
}
}
}
static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("Recognized text: " + e.Result.Text);
}
我不知道我是否使用正确的方法来做到这一点。但是如果你知道另一种方法来解决这个问题,我想知道能够尝试一下
如果缺少某些内容,我可以编辑,我真的需要帮助。从现在开始我一直在努力解决这个问题 3 天
解决方案
推荐阅读
- git - 当我将主分支合并到另一个分支时,它会被修改吗?
- java - 如何使用 Java 在控制台中解析 Python 输出
- php - Laravel - 当另一个类有自己的实例时触发服务提供者
- ios - 长格式快速成功时,地图返回错误
- python-3.x - 如何为我的地块赋予标题并保存它们?
- php - 在 php 中显示错误日期格式输入的 Ymd 格式
- gitlab - 您可以从提交中的问题中引用任务吗?
- spring - 在 shedlock-spring 3.0 中使用什么来代替 ScheduledLockConfiguration Bean?
- excel - 用于检查和创建文件夹系统并保存文件的 VBA 代码
- mysql - 在shell脚本的mysql表列中设置值时出现问题