This is the code i'm using
In google api-explorer for recognize there is option to select speakerTag in the fields section
Thanks!
from How to get speakertag from google speech to text longRunningRecognize method?
const speech = require('@google-cloud/speech');
const client = new speech.SpeechClient({
projectId: Meteor.settings.private.googleCloud.projectId,
keyFilename: getFilePath('google-cloud.json')
});
const config = {
"enableWordTimeOffsets": true,
"encoding": "WAV",
"languageCode": "en-US",
"sampleRateHertz": 44100,
"model": "video"
};
const audio = {
uri: "gs://my-project-name/jeff_bezos_1_mono.wav",
};
const options = {
config: config,
audio: audio,
};
client
.longRunningRecognize(options)
.then(data => {
const operation = data[0];
console.log('got a promise representation', data);
const errorHandler = err => {
console.log(err);
throw(err)
}
const completeHandler = longRRResponse => {
console.log('**** response ****');
console.log(JSON.stringify(longRRResponse, null, 2));
}
const progressHandler = (metadata, apiResponse) => {
console.log('progress ', metadata);
}
operation.on('error', errorHandler)
operation.on('complete', completeHandler)
operation.on('progress', progressHandler)
})
.catch(err => {
console.error('ERROR:', err);
fs.unlink(name);
});
this is the following response I got back{
"results": [
{
"alternatives": [
{
"words": [
{
"startTime": {
"nanos": 100000000
},
"endTime": {
"nanos": 700000000
},
"word": "your"
},
.
.
.
],
"transcript": "your goal is to be the largest online and you are retailer in the world
beyond that what's the goal for our mission is Earth's most customer-centric
company and I know what that mean I'll give you an example",
"confidence": 0.9520494341850281
}
]
},
}
I did not find any information about speakerTag
in response or how to get back speakerTag
information from API?In google api-explorer for recognize there is option to select speakerTag in the fields section
Thanks!
from How to get speakertag from google speech to text longRunningRecognize method?
No comments:
Post a Comment