Real-time speech recognition.
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('speech/recognize@1.0.0');
// Use the profile
const result = await profile
.getUseCase('Recognize')
.perform({
audioContent: '<base64 encoded wav audio>',
languageCode: 'en-US'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"audioContent": "<base64 encoded wav audio>",
"languageCode": "en-US"
}
{
"results": [
{
"alternatives": [
{
"confidence": 0.8393012,
"transcript": "hello world"
}
]
}
]
}