admin管理员组文章数量:1391918
The google transcription service does not identify multiple languages in the registration. Below is my code. I have used different formats (MP3, MP4 and FLAC) and models. But it still doesn't work. This is just a code variant.
What could be the problem why it does not transcribe in multiple languages?
Code for MP3:
new Promise(async (resolve, reject) => {
const request = {
config: {
encoding: "MP3",
sampleRateHertz: 16000,
audioChannelCount: 2,
languageCode: ["en-US"],
alternativeLanguageCodes: ["es-ES", "fr-FR", "en-US"],
useEnhanced: true,
enableWordConfidence: true,
enableWordTimeOffsets: true,
enableAutomaticPunctuation: true
},
audio: {
uri: `gs://${process.env.GOOGLE_CLOUD_STORAGE_BUCKET_SCRIPTOMAN}/multilingual.mp3`
}
};
let [operation] = [];
try {
[operation] = await googleSpeechClient.longRunningRecognize(request);
} catch {
try {
request.config.audioChannelCount = 1;
[operation] = await googleSpeechClient.longRunningRecognize(request);
} catch (error) {
reject(error);
}
}
if ([operation] != undefined && operation != undefined) {
const [response] = await operation.promise();
resolve(response.results);
} else
reject();
}).then(results => {
console.log(results);
}).catch(error => console.log(error));
Code for FLAC:
new Promise(async (resolve, reject) => {
const request = {
config: {
encoding: "FLAC",
audioChannelCount: 2,
languageCode: ["en-US"],
alternativeLanguageCodes: ["es-ES", "fr-FR", "en-US"],
enableWordConfidence: true,
enableWordTimeOffsets: true,
enableAutomaticPunctuation: true
},
audio: {
uri: `gs://${process.env.GOOGLE_CLOUD_STORAGE_BUCKET_SCRIPTOMAN}/multilingual.flac`
}
};
let [operation] = [];
try {
[operation] = await googleSpeechClient.longRunningRecognize(request);
} catch {
try {
request.config.audioChannelCount = 1;
[operation] = await googleSpeechClient.longRunningRecognize(request);
} catch (error) {
reject(error);
}
}
if ([operation] != undefined && operation != undefined) {
const [response] = await operation.promise();
resolve(response.results);
} else
reject();
}).then(results => {
console.log(results);
}).catch(error => console.log(error));
本文标签: Google SpeechtoText does not transcribe in multiple languagesStack Overflow
版权声明:本文标题:Google Speech-to-Text does not transcribe in multiple languages - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744760118a2623703.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论