sdk for fanolabs asr
npm install @fanolabs/asr@fanolabs/asr
==========
[![npm version][npm-image]][npm-url]
FanoLabs Asr module for Node.js
- Installation
- License
- API
- stt(filepath, diarize, recognition_model))
Current stable release (0.1.0)
``sh`
$ npm install @fanolabs/asr --save
, pending the stabalizing of es modules in node:
`js
const ASR = require('@fanolabs/asr');
const client = new ASR({
url: 'https://acdev.fanoai.cn/asr'
});this.test = async function() {
let response = await client.stt('./test.wav', 'cantonese');
if (response.status === 200) {
console.info(response.content);
}
}
this.test();
`API
$3
-
filepath A string representing the local wav file path
- diarize 'True'/'False', default 'False'
- recognition_model Choose which recognition model to use.
- Returns:
Note: successful response
`js
{
'status': 200,
'content': [{
'recording_id': 'speech',
'start_time': 0.83,
'end_time': 1.62,
'n_bests': [{
'text': '明白街',
'confidence': 0.121796916
}],
'text': '明白街',
'confidence': 0.121796916,
'success': True
}]
}
`
Note: Error handling
`js
{
'status': 500,
'statusText': 'Internal Server Error'
}
``MIT
[npm-image]: https://flat.badgen.net/npm/v/babel-core
[npm-url]: https://www.npmjs.com/package/@fanolabs/asr