IMB 的语音转文本服务可以做到这一点。如果您使用他们的休息服务非常简单,只需添加您希望在 url 参数中识别不同的扬声器。此处的文档(https://console.bluemix.net/docs/services/speech-to-text/output.html#speaker_labels)
它的工作原理是这样的:
curl -X POST -u {username}:{password}
--header "Content-Type: audio/flac"
--data-binary @{path}audio-multi.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_NarrowbandModel&speaker_labels=true"
然后它将返回一个带有结果和扬声器标签的 json,如下所示:
{
"results": [
{
"alternatives": [
{
"timestamps": [
[
"hello",
0.68,
1.19
],
[
"yeah",
1.47,
1.93
],
[
"yeah",
1.96,
2.12
],
[
"how's",
2.12,
2.59
],
[
"Billy",
2.59,
3.17
],
. . .
]
"confidence": 0.821,
"transcript": "hello yeah yeah how's Billy "
}
],
"final": true
}
],
"result_index": 0,
"speaker_labels": [
{
"from": 0.68,
"to": 1.19,
"speaker": 2,
"confidence": 0.418,
"final": false
},
{
"from": 1.47,
"to": 1.93,
"speaker": 1,
"confidence": 0.521,
"final": false
},
{
"from": 1.96,
"to": 2.12,
"speaker": 2,
"confidence": 0.407,
"final": false
},
{
"from": 2.12,
"to": 2.59,
"speaker": 2,
"confidence": 0.407,
"final": false
},
{
"from": 2.59,
"to": 3.17,
"speaker": 2,
"confidence": 0.407,
"final": false
},
. . .
]
}
他们还具有用于不同平台的 Web 套接字选项和 SDK,可以访问它,而不仅仅是休息调用。
祝你好运