Skip to content

Commit 099032c

Browse files
author
Dolev Dotan
committed
Update version to 0.10.4
Merge branch 'master' of https://github.com/watson-developer-cloud/nodejs-wrapper Conflicts: package.json
2 parents 32803dd + ac9026c commit 099032c

File tree

33 files changed

+1257
-161
lines changed

33 files changed

+1257
-161
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
node_modules/*
22
npm-debug.log
33
coverage
4-
.DS_Store
4+
.DS_Store
5+
test/resources/auth.js
6+
test/resources/mobydick.txt
7+
test/test.all-services.js
8+
test/resources/tts-output.ogg
9+
test/resources/face.jpg

.jshintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.jshintrc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
},
1616

1717
"node" : true,
18-
"es5" : true,
19-
"browser" : true,
18+
"browser" : false,
2019

2120
"boss" : false,
2221
"curly": false,
@@ -26,7 +25,6 @@
2625
"evil": true,
2726
"forin": false,
2827
"immed": true,
29-
"maxlen": 100,
3028
"indent": 2,
3129
"quotmark": "single",
3230
"laxbreak": false,
@@ -43,4 +41,4 @@
4341
"strict": true,
4442
"white": true,
4543
"unused": true
46-
}
44+
}

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
language: node_js
2+
sudo: false # causes tests to be run in Travis CI's newer, faster build infrastructure
23
node_js:
34
- "0.10"
5+
- "0.12"
6+
- "stable"
47
script:
58
- npm test
69
after_success:
7-
- npm run coveralls
10+
- npm run coveralls

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2525
* [Concept Expansion](#concept-expansion)
2626
* [Concept Insights](#concept-insights)
2727
* [Dialog](#dialog)
28+
* [Document Conversion](#document-conversion)
2829
* [Language Translation](#language-translation)
2930
* [Message Resonance](#message-resonance)
3031
* [Natural Language Classifier](#natural-language-classifier)
@@ -191,14 +192,11 @@ var watson = require('watson-developer-cloud');
191192
var concept_insights = watson.concept_insights({
192193
username: '<username>',
193194
password: '<password>',
194-
version: 'v1'
195+
version: 'v2'
195196
});
196197

197-
/*** Annotate Text ***/
198-
199198
var params = {
200-
user: 'wikipedia',
201-
graph: 'en-20120601',
199+
graph: '/graphs/wikipedia/en20120601',
202200
text: 'IBM Watson won the Jeopardy television show hosted by Alex Trebek'
203201
};
204202

@@ -207,32 +205,9 @@ concept_insights.annotateText(params, function(err, res) {
207205
if (err)
208206
console.log(err);
209207
else {
210-
console.log("\n*** Annotate Text ***\n");
211208
console.log(JSON.stringify(res, null, 2));
212209
}
213210
});
214-
215-
/*** Semantic Search ***/
216-
217-
var payload = {
218-
func: 'semanticSearch',
219-
ids: [
220-
'/graph/wikipedia/en-20120601/Software_development_process',
221-
'/graph/wikipedia/en-20120601/Programming_tool'
222-
],
223-
corpus: 'ibmresearcher',
224-
user: 'public',
225-
limit: 5
226-
};
227-
228-
concept_insights.semanticSearch(payload, function(error, results) {
229-
if (error)
230-
console.log(error);
231-
else {
232-
console.log("\n*** Semantic Search ***\n");
233-
console.log(JSON.stringify(results, null, 2));
234-
}
235-
});
236211
```
237212

238213
### Dialog
@@ -247,12 +222,37 @@ var dialog = watson.dialog({
247222
version: 'v1'
248223
});
249224

250-
251225
dialog.getDialogs({}, function (err, dialogs) {
252-
if (err)
253-
console.log('error:', err);
254-
else
255-
console.log(JSON.stringify(dialogs, null, 2));
226+
if (err)
227+
console.log('error:', err);
228+
else
229+
console.log(JSON.stringify(dialogs, null, 2));
230+
});
231+
```
232+
233+
### Document Conversion
234+
235+
```javascript
236+
var watson = require('watson-developer-cloud');
237+
var fs = require('fs');
238+
239+
var document_conversion = watson.document_conversion({
240+
username: '<username>',
241+
password: '<password>',
242+
version: 'v1-experimental'
243+
});
244+
245+
// convert a single document
246+
document_conversion.convert({
247+
// (JSON) ANSWER_UNITS, NORMALIZED_HTML, or NORMALIZED_TEXT
248+
file: fs.createReadStream('sample-docx.docx'),
249+
conversion_target: document_conversion.conversion_target.ANSWER_UNITS
250+
}, function (err, response) {
251+
if (err) {
252+
console.error(err);
253+
} else {
254+
console.log(JSON.stringify(response, null, 2));
255+
}
256256
});
257257
```
258258

@@ -278,7 +278,7 @@ language_translation.translate({
278278
console.log(JSON.stringify(translation, null, 2));
279279
});
280280

281-
language_identification.identify({
281+
language_translation.identify({
282282
text: 'The language translation service takes text input and identifies the language used.' },
283283
function (err, language) {
284284
if (err)
@@ -327,7 +327,7 @@ var natural_language_classifier = watson.natural_language_classifier({
327327

328328
natural_language_classifier.classify({
329329
text: 'Is it sunny?',
330-
classifier: '<classifier-id>' },
330+
classifier_id: '<classifier-id>' },
331331
function(err, response) {
332332
if (err)
333333
console.log('error:', err);

RELEASE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Release process
2+
3+
Standard practice with node.js modules is to commit all of the changes for a release except updating the package.json version, and then run the following:
4+
5+
```
6+
npm version major|minor|patch
7+
git push --tags
8+
git push origin master
9+
npm publish
10+
```
11+
12+
`npm version *` will update the package.json version field appropriately and create a git commit and tag for the version.
13+
`git push --tags` will publish the tag to github., and then immediately.
14+
`git push origin master` will publish the changes to package.json.
15+
`npm publish` will publish the npm package.
16+
17+
The reason for this is that it allows someone to easily view the source code (and readme) for whatever version they happen to have downloaded from npm. This is particularly helpful when github is ahead of npm.

examples/concept_insights.v2.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var watson = require('watson-developer-cloud');
4+
5+
var concept_insights = watson.concept_insights({
6+
username: 'INSERT YOUR USERNAME FOR THE SERVICE HERE',
7+
password: 'INSERT YOUR PASSWORD FOR THE SERVICE HERE',
8+
version: 'v2'
9+
});
10+
11+
var params = {
12+
graph: '/graphs/wikipedia/en20120601',
13+
text: 'IBM Watson won the Jeopardy television show hosted by Alex Trebek'
14+
};
15+
16+
// Retrieve the concepts for input text
17+
concept_insights.annotateText(params, function(err, res) {
18+
if (err)
19+
console.log(err);
20+
else {
21+
console.log('Annotated Text');
22+
console.log(JSON.stringify(res, null, 2));
23+
}
24+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
var watson = require('watson-developer-cloud');
4+
var fs = require('fs');
5+
6+
var document_conversion = watson.document_conversion({
7+
username: 'INSERT YOUR USERNAME FOR THE SERVICE HERE',
8+
password: 'INSERT YOUR PASSWORD FOR THE SERVICE HERE',
9+
version: 'v1-experimental'
10+
});
11+
12+
// convert a single document
13+
document_conversion.convert({
14+
// (JSON) ANSWER_UNITS, NORMALIZED_HTML, or NORMALIZED_TEXT
15+
file: fs.createReadStream(__dirname + '/resources/document_conversion/sample-docx.docx'),
16+
conversion_target: document_conversion.conversion_target.ANSWER_UNITS
17+
}, function (err, response) {
18+
if (err) {
19+
console.error(err);
20+
} else {
21+
console.log(JSON.stringify(response, null, 2));
22+
}
23+
});

examples/natural_language_classifier.v1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ natural_language_classifier.create(params, function(err, response) {
2929
// Using a classifier
3030
natural_language_classifier.classify({
3131
text: 'Is it sunny?',
32-
classifier: '<classifier-id>' }, // from the previous command
32+
classifier_id: '<classifier-id>' }, // from the previous command
3333
function(err, response) {
3434
if (err)
3535
console.log('error:', err);
17.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)