我正在尝试用谷歌语音将 ivr 电话转录为文本,但我无法分离音频,我只收到一个长文本,我想在用户停止通话和 ivr 响应后通过清除结果来删除它。这是我的代码:
app.ws('/socket', (ws, req) => {
let request ={
config: {
encoding: 'LINEAR16',
sampleRateHertz: 16000,
languageCode: 'iw-IL'
},
interimResults: true
};
const recognizeStream = client
.streamingRecognize(request)
.on('error', console.error)
.on('data', data => {
console.log(
`Transcription: ${data.results[0].alternatives[0].transcript}`
);
});