Skip to content

Commit

Permalink
docs(compare-comply): add documentation and an example
Browse files Browse the repository at this point in the history
  • Loading branch information
dpopp07 committed Dec 6, 2018
1 parent b0569b6 commit 62ce280
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,39 @@ assistant.message(
);
```

### Compare Comply

Use the Compare Comply service to compare and classify documents.

```javascript
const fs = require('fs');
const CompareComplyV1 = require('watson-developer-cloud/compare-comply/v1');

const compareComply = new CompareComplyV1({
iam_apikey: '<iam_apikey>',
url: 'https://gateway.watsonplatform.net/compare-comply/api',
version: '2018-12-06'
});

compareComply.compareDocuments(
{
file_1: fs.createReadStream('<path-to-file-1>'),
file_1_filename: '<filename-1>',
file_1_label: 'file-1',
file_2: fs.createReadStream('<path-to-file-2>'),
file_2_filename: '<filename-2>',
file_2_label: 'file-2',
},
function(err, response) {
if (err) {
console.error(err);
} else {
console.log(JSON.stringify(response, null, 2));
}
}
);

```

### Conversation

Expand Down Expand Up @@ -381,6 +414,7 @@ discovery.query(
);

```

### Language Translator v3

Translate text from one language to another or idenfity a language using the [Language Translator][language_translator] service.
Expand Down
29 changes: 29 additions & 0 deletions examples/compare-comply.v1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const fs = require('fs');
const CompareComplyV1 = require('watson-developer-cloud/compare-comply/v1');

const compareComply = new CompareComplyV1({
// if left unspecified here, the SDK will fall back to the COMPARE_COMPLY_IAM_APIKEY
// environment property, and then Bluemix's VCAP_SERVICES environment property
iam_apikey: 'YOUR APIKEY',
url: 'https://gateway.watsonplatform.net/compare-comply/api',
version: '2018-12-06'
});

const params = {
file_1: fs.createReadStream(__dirname + '/../test/resources/contract_A.pdf'),
file_1_filename: 'contract_A.pdf',
file_1_label: 'example-file-1',
file_2: fs.createReadStream(__dirname + '/../test/resources/contract_B.pdf'),
file_2_filename: 'contract_B.pdf',
file_2_label: 'example-file-2',
};

compareComply.compareDocuments(params, (error, data) => {
if (error) {
console.log(error);
} else {
console.log(data);
}
);

0 comments on commit 62ce280

Please sign in to comment.