c# - 认知服务。 Azure 端点不工作

标签 c# azure unity-game-engine speech-to-text azure-cognitive-services

我集成了 Microsoft 认知服务 Speech to Text 的 30 天免费试用版。

var config = SpeechConfig.FromSubscription("fake", "westus");

   using (var recognizer = new SpeechRecognizer(config))
      {
        lock (threadLocker)
        {
            waitingForReco = true;
        }

        var result = recognizer.RecognizeOnceAsync().Result;

        string newMessage = string.Empty;
        if (result.Reason == ResultReason.RecognizedSpeech)
        {

            newMessage = result.Text;
        }
        else if (result.Reason == ResultReason.NoMatch)
        {
            newMessage = "NOMATCH: Speech could not be recognized.";
        }
        else if (result.Reason == ResultReason.Canceled)
        {
            var cancellation = CancellationDetails.FromResult(result);
            newMessage = $"CANCELED: Reason={cancellation.Reason} ErrorDetails={cancellation.ErrorDetails}";
        }

        lock (threadLocker)
        {
            message = newMessage;
            waitingForReco = false;
        }
    }

当我使用免费演示 key 连接到 api 时,它可以工作。当我在 Azure 中创建 Azure 认知服务时,它总是返回“已取消”。

我必须为此演示 key 和生产 key 配置任何其他差异吗?

最佳答案

我认为您可能创建了错误的服务。对于认知服务来说,有很多种类型,比如face、luis、speechservice等等。在这种情况下,您需要在azure门户上创建资源时通过搜索语音来创建语音服务。

enter image description here

enter image description here

希望对你有帮助!

关于c# - 认知服务。 Azure 端点不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56045679/

相关文章:

c# - 我的程序快速排序不起作用

c# - 将 Serilog 与 Azure 日志流结合使用

xml - 直接从 Azure SQL 报告服务器加载 xml 报告

azure - 如何取消我的 Microsoft Azure 订阅?

javascript - 如何在 Three.js 场景中平滑多边形?

c# - unity 脚本对象在构建中不起作用

c# - 如果 Try/Catch 中没有捕获则运行代码

c# - 如何提高 Mongo 更新操作的性能?

ios - 禁用 AVAudioSession 后 Unity 声音无法工作

c# - 使用 ToString ("F1"时 float 的舍入不正确)