【问题标题】:How to test Speech input in microsoft BOT?如何在 Microsoft BOT 中测试语音输入?
【发布时间】:2017-08-11 21:41:58
【问题描述】:

我已将语音输入 api (Bing Speech API) 集成到我正在开发的一个 BOT(MS BOT 框架-.net)中,但不确定如何测试它是否正常工作。 MS Bot 模拟器是否有助于使用麦克风对其进行测试?还是我应该使用Skype之类的任何频道来测试它? 请帮忙。

谢谢

【问题讨论】:

    标签: speech-recognition speech-to-text botframework


    【解决方案1】:

    我使用https://docs.botframework.com/en-us/skype/calling/#calling-conversation-object-model 中定义的录制操作创建了一个 Skype 机器人来录制用户的音频,然后在使用声音文件完成录制后使用 Bing 语音识别 API 执行语音到文本。

          private async Task OnRecordCompleted(RecordOutcomeEvent recordOutcomeEvent)
        {      
          string s = string.Empty;
                     string path = string.Empty;
                      if (recordOutcomeEvent.RecordOutcome.Outcome = Outcome.Success)
                     {
                          var record = await recordOutcomeEvent.RecordedContent;
                path =               HttpContext.Current.Server.MapPath($"~/{recordOutcomeEvent.RecordOutcome.Id}.wav");
                using (var writer = new FileStream(path, FileMode.Create))
                {
                    await record.CopyToAsync(writer);
                }
                Attachment att = new Attachment()
                {
                    ContentUrl = "file:///" + path,
                    ContentType = "audio/wav",
    
                };
                s = DoSpeechReco(att);
    

    【讨论】:

    【解决方案2】:

    许多通道允许您将音频文件发送到您的机器人。如果您在 Facebook Messenger 上启用机器人,只需按下麦克风图标即可录制音频

    录制音频的播放器将出现在用户的流中,并且音频文件作为附件传回您的机器人:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-11
      • 2019-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多