您好,我正在使用 Nuance 进行一些关于语音到文本的实验,我正在使用节点创建请求,如下所示:
我的凭据:
var Nuance = require("nuance");
var nuance = new Nuance("mycredentials", "mypass");
然后我发送请求如下:
nuance.sendDictationRequest({
"identifier": "randomIdentifierStringHere", //The user identifier (please refer to Nuance's documentation for more info).
"language": "es_MX", //The language code (please refer to Nuance's documentation for more info).
"path": "12min.amr", //The path to the file you would like to send to Nuance.
"additionalHeaders": {}, //If you'd like to supply more headers or replace the default headers, supply them here.
"success": function(resp){ //The success callback function.
console.log(resp);
},
"error": function(resp){ //The error callback function - returns the response from Nuance that you can debug.
console.log("An error was occurred.");
console.log(resp);
}
});
这种方式的问题是我需要使用几个调用来改变这部分:
"path": "12min.amr", //The path to the file you would like to send to Nuance.
由于我在终端中执行请求如下:
node call12.js
然后我在终端上得到结果。
我试过了:
nuance.sendDictationRequest({
"identifier": "randomIdentifierStringHere", //The user identifier (please refer to Nuance's documentation for more info).
"language": "es_MX", //The language code (please refer to Nuance's documentation for more info).
"path": "4min.amr", //The path to the file you would like to send to Nuance.
"additionalHeaders": {}, //If you'd like to supply more headers or replace the default headers, supply them here.
"success": function(resp){ //The success callback function.
console.log(resp);
},
"error": function(resp){ //The error callback function - returns the response from Nuance that you can debug.
console.log("An error was occurred.");
console.log(resp);
}
});
nuance.sendDictationRequest({
"identifier": "randomIdentifierStringHere", //The user identifier (please refer to Nuance's documentation for more info).
"language": "es_MX", //The language code (please refer to Nuance's documentation for more info).
"path": "2min.amr ", //The path to the file you would like to send to Nuance.
"additionalHeaders": {}, //If you'd like to supply more headers or replace the default headers, supply them here.
"success": function(resp){ //The success callback function.
console.log(resp);
},
"error": function(resp){ //The error callback function - returns the response from Nuance that you can debug.
console.log("An error was occurred.");
console.log(resp);
}
});
只处理 2 次对话我正在重复代码,因为我不相信这是最佳方式。为了处理我的所有文件:
2min.amr 4min.amr 8min.amr
我想知道如何创建一个 for 以便在一个脚本中处理更多文件,所以我真的很想感谢支持以克服这项任务。