Skip to content

Commit

Permalink
Merge pull request #245 from chughts/ttscustom
Browse files Browse the repository at this point in the history
TTS Customisation
  • Loading branch information
chughts authored Jan 28, 2017
2 parents c208703 + 28d9e30 commit 7214c79
Show file tree
Hide file tree
Showing 9 changed files with 869 additions and 17 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Node-RED Watson Nodes for IBM Bluemix

<a href="https://cla-assistant.io/watson-developer-cloud/node-red-node-watson"><img src="https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson" alt="CLA assistant" /></a>

### New in version 0.4.38
- New Node for Text to Speech Customizations
- Added option to select Customization in Text To Speech Node.

### New in version 0.4.37
- Added support for word training in Speech to Text Customizations Node.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-watson",
"version": "0.4.37",
"version": "0.4.38",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"alchemy-api": "^1.3.0",
Expand Down Expand Up @@ -57,6 +57,7 @@
"watson-speech-to-text-v1": "services/speech_to_text/v1.js",
"watson-speech-to-text-corpus-builder-v1": "services/speech_to_text/v1-corpus-builder.js",
"watson-text-to-speech-v1": "services/text_to_speech/v1.js",
"watson-text-to-speech-corpus-builder-v1": "services/text_to_speech/v1-corpus-builder.js",
"watson-tone-analyzer-v3": "services/tone_analyzer/v3.js",
"watson-tradeoff-analytics-v1": "services/tradeoff_analytics/v1.js",
"watson-tone-analyzer-v3-beta": "services/tone_analyzer/v3-beta.js",
Expand Down
2 changes: 1 addition & 1 deletion services/language_translator_identify/v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</script>

<script type="text/x-red" data-help-name="watson-language-translator-identify">
<p>Packaged in with release 0.4.37 of node-red-node-watson</p>
<p>Packaged in with release 0.4.38 of node-red-node-watson</p>
<p>The Watson Language Translator service can be used to identify languages used in a text input. <p>
<p>Node input : </p>
<ul>
Expand Down
25 changes: 14 additions & 11 deletions services/speech_to_text/v1-corpus-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = function (RED) {
fs = require('fs'),
fileType = require('file-type'),
serviceutils = require('../../utilities/service-utils'),
payloadutils = require('../../utilities/payload-utils'),
STTV1 = require('watson-developer-cloud/speech-to-text/v1'),
service = serviceutils.getServiceCreds(SERVICE_IDENTIFIER),
username = '', password = '', sUsername = '', sPassword = '';
Expand All @@ -44,19 +45,21 @@ module.exports = function (RED) {
sPassword = service.password;
}

/*
function reportError (node, msg, message) {
var messageTxt = message.error ? message.error : message;
msg.stterror = messageTxt;
node.status({fill:'red', shape:'dot', text: messageTxt});
node.error(messageTxt, msg);
}
*/

function executeCreateCustomisation(node, stt, params, msg) {
stt.createCustomization(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['customization_id'] = response;
}
Expand All @@ -68,7 +71,7 @@ module.exports = function (RED) {
stt.getCustomizations(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['customizations'] = response.customizations ?
response.customizations: response;
Expand All @@ -81,7 +84,7 @@ module.exports = function (RED) {
stt.getCustomization(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['customization'] = response ;
}
Expand All @@ -93,7 +96,7 @@ module.exports = function (RED) {
stt.addCorpus(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['addcorpusresponse'] = response ;
}
Expand All @@ -105,7 +108,7 @@ module.exports = function (RED) {
stt.getCorpora(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['corpora'] = response.corpora ? response.corpora : response ;
}
Expand All @@ -117,7 +120,7 @@ module.exports = function (RED) {
stt.trainCustomization(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['train'] = response ;
}
Expand All @@ -129,7 +132,7 @@ module.exports = function (RED) {
stt.getWords(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['words'] = response.words ? response.words : response ;
}
Expand All @@ -141,7 +144,7 @@ module.exports = function (RED) {
stt.addWords(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['addwordsresponse'] = response ;
}
Expand All @@ -154,7 +157,7 @@ module.exports = function (RED) {
stt.deleteCorpus(params, function (err, response) {
node.status({});
if (err) {
reportError(node, msg, err);
payloadutils.reportError(node, msg, err);
} else {
msg['delcorpusresponse'] = response ;
}
Expand All @@ -165,7 +168,7 @@ module.exports = function (RED) {
function executeMethod(node, method, params, msg) {
var stt = new STTV1({
username: username,
password: password,
password: password
});

node.status({fill:'blue', shape:'dot', text:'executing'});
Expand Down Expand Up @@ -340,7 +343,7 @@ module.exports = function (RED) {
}

if (message) {
reportError(node, msg, message);
payloadutils.reportError(node, msg, message);
return;
}

Expand Down
Loading

0 comments on commit 7214c79

Please sign in to comment.