nuance-nodejs
A simple Nuance HTTP Client for NodeJS.
Installation
Download the source or use NPM:
npm install nuance --save
##Usage
First, you need to create a new Nuance instance:
var Nuance = require("nuance");
var nuance = new Nuance();
The next step is loading the file:
nuance.loadFile(path, function(fileLoaded){
if(fileLoaded){
}
else{
}
});
After the file has been loaded successfully, we may procceed with sending the request:
nuance.sendRequest(language, id, additionalHeaders, function(error, response){
console.log(response);
});
language = The language code (for example: "eng-USA").
id = The user's identifier - you should send here a random generated string for each user.
additionalHeaders = An object containing more headers than the default headers
error = If the request failed for some reason, the error will be the response object.
response = If successfull, returns an array with whatever Nuance analyzed. If not successfull - it will be undefined.
A whole code should look like this:
var Nuance = require("nuance");
var nuance = new Nuance();
nuance.loadFile(path, function(fileLoaded){
if(fileLoaded){
nuance.sendRequest(language, id, additionalHeaders, function(error, response){
if(error){
}
else{
console.log(response);
}
});
}
else{
}
});
##Notes
- If you receive error 500 with AUDIO_INFO - the headers you had sent are probably wrong.
- Please make sure you are sending the right headers with the right language.
- Feel free to modify the default headers in the index.js file, at the moment they are set to handle AMR files.
- You may replace the default headers by suppling additionalHeaders, so you don't have to change the default headers in the index.js file.
- You need to supply apiKey and appID in the index.js file.