AWS Transcribe-当我们看到“IsPartial”标志设置为False时如何停止转录

2019年9月10日 53点热度 0条评论

当AWS Transcribe仍在流式传输时,isPartial标志将设置为True。一旦将isPartial标志设置为False,我想停止流式传输。

有人做吗?

https://docs.aws.amazon.com/transcribe/latest/dg/transcribe-dg.pdf#streaming

这是杰森(Json):

{
  "TranscriptResultStream": {
    "TranscriptEvent": {
      "Transcript": {
        "Results": [
          {
            "Alternatives": [
              {
                "Items": [
                  {
                    "Content": "the",
                    "EndTime": 0.3799375,
                    "StartTime": 0.0299375,
                    "Type": "pronunciation"
                  },
                  {
                    "Content": "amazon",
                    "EndTime": 0.5899375,
                    "StartTime": 0.3899375,
                    "Type": "pronunciation"
                  },
                  {
                    "Content": "is",
                    "EndTime": 0.7899375,
                    "StartTime": 0.5999375,
                    "Type": "pronunciation"
                  },
                  {
                    "Content": "the",
                    "EndTime": 0.9199375,
                    "StartTime": 0.7999375,
                    "Type": "pronunciation"
                  },
                  {
                    "Content": "largest",
                    "EndTime": 1.0199375,
                    "StartTime": 0.9299375,
                    "Type": "pronunciation"
                  }
                ],
                "Transcrip`enter code here`t": "the amazon is the largest"
              }
            ],
            "EndTime": 1.02,
            "IsPartial": true,
            "ResultId": "2db76dc8-d728-11e8-9f8b-f2801f1b9fd1",
            "StartTime": 0.0199375
          }
        ]
      }
    }
  }
}

解决方案如下:

空音频帧信号流结束。如文档中所指定:“要结束音频数据流,请在事件流编码的消息中发送空的音频块”。