Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

watson-developer-cloud

Package Overview
Dependencies
Maintainers
2
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watson-developer-cloud - npm Package Compare versions

Comparing version 0.9.27 to 0.9.28

package/.npmignore

7

package.json
{
"name": "watson-developer-cloud",
"version": "0.9.27",
"version": "0.9.28",
"description": "Nodejs Client Wrapper to use the IBM Watson Services",

@@ -60,2 +60,3 @@ "main": "./lib/index",

"cookie": "~0.1.3",
"csv-stringify": "~0.0.8",
"extend": "~3.0.0",

@@ -66,4 +67,4 @@ "isstream": "~0.1.2",

"request": "~2.60.0",
"string": "~3.3.0",
"solr-client" : "~0.5.0"
"solr-client": "~0.5.0",
"string": "3.3.1"
},

@@ -70,0 +71,0 @@ "engines": {

@@ -122,3 +122,3 @@ Watson Developer Cloud Node.js Client

authorization.getToken(params, function (token) {
authorization.getToken(params, function (err, token) {
if (!token) {

@@ -343,2 +343,3 @@ console.log('error:', err);

var natural_language_classifier = watson.natural_language_classifier({
url: 'https://gateway.watsonplatform.net/natural-language-classifier/api',
username: '<username>',

@@ -360,3 +361,3 @@ password: '<password>',

For the command line interface and tutorial, See [Natural Language Classifier CLI](http://github.com/watson-developer-cloud/natural-language-classifier-nodejs-cli)
See this [example](https://github.com/watson-developer-cloud/nodejs-wrapper/blob/master/examples/natural_language_classifier.v1.js) to learn how to create a classifier.

@@ -363,0 +364,0 @@ ### Personality Insights

@@ -22,2 +22,5 @@ /**

var pick = require('object.pick');
var omit = require('object.omit');
var isStream = require('isstream');
var toCSV = require('./json-training-to-csv');

@@ -27,3 +30,3 @@ function NaturalLanguageClassifier(options) {

var serviceDefaults = {
url: 'https://gateway.watsonplatform.net/natural-language-classifier-experimental/api'
url: 'https://gateway.watsonplatform.net/natural-language-classifier-beta/api'
};

@@ -39,13 +42,39 @@ this._options = extend(serviceDefaults, options);

var parameters = {
options: {
method: 'POST',
url: '/v1/classifiers',
body: params,
json: true
},
requiredParams: ['language', 'training_data'],
defaultOptions: this._options
};
return requestFactory(parameters, callback);
if (!params || !params.training_data) {
callback(new Error('Missing required parameters: training_data'));
return;
}
if (!((Array.isArray(params.training_data)) ||
(typeof params.training_data === 'string') ||
(isStream(params.training_data)))) {
callback(new Error('training_data needs to be a String, Array or Stream'));
return;
}
var self = this;
toCSV(params.training_data, function(err, csv) {
if (err) {
callback(err);
return;
}
var parameters = {
options: {
url: '/v1/classifiers',
method: 'POST',
json: true,
formData: {
training_data: csv,
training_metadata: JSON.stringify(omit(params, ['training_data']))
},
// hack to check required parameters.
// We don't actually need path parameters
path: pick(params, ['language'])
},
requiredParams: ['language'],
defaultOptions: self._options
};
return requestFactory(parameters, callback);
});
};

@@ -130,2 +159,2 @@

module.exports = NaturalLanguageClassifier;
module.exports = NaturalLanguageClassifier;

@@ -42,3 +42,3 @@ /**

result = JSON.parse(result);
return result[result.lenght - 1];
return result[result.length - 1];
} catch (e) {}

@@ -56,3 +56,3 @@

var serviceDefaults = {
url: 'https://stream.watsonplatform.net/speech-to-text-beta/api'
url: 'https://stream.watsonplatform.net/speech-to-text/api'
};

@@ -59,0 +59,0 @@

@@ -26,3 +26,3 @@ /**

var serviceDefaults = {
url: 'https://stream.watsonplatform.net/text-to-speech-beta/api',
url: 'https://stream.watsonplatform.net/text-to-speech/api',
headers: {

@@ -29,0 +29,0 @@ 'content-type': 'application/json'

@@ -19,52 +19,8 @@ /**

var extend = require('extend');
var requestFactory = require('../../lib/requestwrapper');
var toContentItems = function(text){
return {
contentItems : [{
userid : 'dummy',
id : 'dummyUuid',
sourceid : 'freetext',
contenttype : 'text/plain',
language : 'en',
content: text
}]
};
};
function UserModeling(options) {
// Default URL
var serviceDefaults = {
url: 'https://gateway.watsonplatform.net/user-modeling-beta/api'
};
// Replace default options with user provided
this._options = extend(serviceDefaults, options);
function UserModeling() {
console.warn('WARNING! The User Modeling has been replaced by Personality Insights.');
console.warn('See https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/personality-insights.html');
throw Error('Service deprecated');
}
UserModeling.prototype.profile = function(_params, callback) {
var body = _params || {};
// If 'text' is specified, build the contentItems object using text
if (body.text)
body = toContentItems(body.text);
if (!body.contentItems) {
callback(new Error('Missing required parameters: text or contentItems'));
return;
}
var parameters = {
options: {
method: 'POST',
url: '/v2/profile',
body: body,
json: true,
},
defaultOptions: this._options
};
return requestFactory(parameters, callback);
};
module.exports = UserModeling;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc