Skip to content

Commit 03ae0c8

Browse files
committed
Merge branch 'develop'
2 parents 2d23cb3 + 4e62168 commit 03ae0c8

13 files changed

+280
-236
lines changed

Diff for: .travis.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: node_js
2+
# https://nodejs.org/en/about/releases/#releases
23
node_js:
3-
- "6.15.1"
4-
- "7.10.1"
5-
- "8.14.0"
6-
- "9.11.2"
7-
- "10.14.1"
8-
- "11.4.0"
4+
- "8"
5+
- "9"
6+
- "10"
7+
- "11"
8+
- "12"
99
before_install:
1010
- npm install -g npm
1111
before_script:

Diff for: DEVELOPER.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Binding Developer Info
2+
3+
#### Build and Release Instructions
4+
TBD
5+
Include notes on updating Travis test versions, keeping `package.json` fresh.
6+
Maybe some notes on updating dependency versions, linting, dependency vulnerabilities, etc.
7+
There appears to be some mixed whitespace that should be tidied up.
8+
9+
10+
#### Old Docker Info From Examples
11+
If we want to keep this, let's clean it up.
12+
13+
`runAll.sh` is testing a string instead of an http code.
14+
`runAl.sh` and `Dockerfile` may need to be consolidated with the other example scripts.
15+
16+
Here are the old instructions from examples/README.
17+
18+
##### Docker
19+
A Docker image for running the examples against the compiled source library is available on Docker Hub.
20+
21+
Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-nodejs`
22+
23+
Additional environment settings:
24+
`-e ALT_URL=<alternative URL>`
25+
`-e FILENAME=<single filename>`
26+
27+
##### Example using the Rosette API language detection endpoint
28+
```javascript
29+
var Api = require('rosette-api');
30+
31+
var api = new Api(API_KEY);
32+
var endpoint = "language";
33+
var content = "Por favor Señorita, says the man.";
34+
api.parameters.content = content;
35+
36+
api.rosette(endpoint, function(err, res){
37+
if(err){
38+
console.log(err);
39+
} else {
40+
console.log(JSON.stringify(res, null, 2));
41+
}
42+
});
43+
```

Diff for: README.md

+37-83
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,37 @@
1-
[![Build Status](https://travis-ci.org/rosette-api/nodejs.svg?branch=develop)](https://travis-ci.org/rosette-api/nodejs) [![npm version](https://badge.fury.io/js/rosette-api.svg)](https://badge.fury.io/js/rosette-api)
2-
3-
# rosette-api
4-
5-
This is the Rosette API client binding for node.js.
6-
7-
## Getting Started
8-
Install the module with: `npm install rosette-api`
9-
10-
If the version you are using is not [the latest from npm](https://www.npmjs.com/package/rosette-api) (or `npm show rosette-api@* version`),
11-
please check for its [**compatibilty with api.rosette.com**](https://developer.rosette.com/features-and-functions?javascript).
12-
If you have an on-premise version of Rosette API server, please contact support for
13-
binding compatibility with your installation.
14-
15-
To check your installed version:
16-
17-
- `npm list rosette-api` for local installation
18-
- `npm list -g rosette-api` for global installation
19-
20-
https://www.npmjs.com/package/rosette-api
21-
22-
## Docker ##
23-
A Docker image for running the examples against the compiled source library is available on Docker Hub.
24-
25-
Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-nodejs`
26-
27-
Additional environment settings:
28-
`-e ALT_URL=<alternative URL>`
29-
`-e FILENAME=<single filename>`
30-
31-
32-
## Example using the Rosette API language detection endpoint
33-
```javascript
34-
var Api = require('rosette-api');
35-
36-
var api = new Api(API_KEY);
37-
var endpoint = "language";
38-
var content = "Por favor Señorita, says the man.";
39-
api.parameters.content = content;
40-
41-
api.rosette(endpoint, function(err, res){
42-
if(err){
43-
console.log(err);
44-
} else {
45-
console.log(JSON.stringify(res, null, 2));
46-
}
47-
});
48-
```
49-
## API Parameters
50-
| Parameter | Endpoint | Required
51-
| ------------- |------------- |-------------
52-
| content | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics, transliteration | Either content or contentUri required, transliteration requires content only |
53-
| contentUri | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics | Either content or contentUri required |
54-
| language | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics, name similarity | No |
55-
| documentFile | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics | No |
56-
| name1 | name similarity | Yes |
57-
| name2 | name similarity| Yes |
58-
| name | name translation | Yes |
59-
| names | name deduplication | Yes |
60-
| targetLanguage | name translation, transliteration (No) | Yes |
61-
| entityType | name translation | No |
62-
| sourceLanguageOfOrigin | name translation | No |
63-
| sourceLanguageOfUse | name translation | No |
64-
| sourceLanguage | transliteration | No |
65-
| sourceScript | name translation, transliteration | No |
66-
| targetScript | name translation, transliteration | No |
67-
| targetScheme | name translation | No |
68-
| options | relationships | No |
69-
| accuracyMode | relationships | Yes |
70-
| explain | sentiment | No |
71-
| morphology | morphology | Yes |
72-
73-
## Additional Examples
74-
See [examples](examples).
75-
76-
## API Documentation
77-
See [documentation](http://rosette-api.github.io/nodejs)
78-
79-
## Release Notes
80-
See [wiki](https://github.com/rosette-api/nodejs/wiki/Release-Notes)
81-
82-
## Additional Information
83-
See [Rosette API site](https://developer.rosette.com/)
1+
<a href="https://www.rosette.com"><img src="https://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>
2+
3+
---
4+
5+
[![Build Status](https://travis-ci.org/rosette-api/nodejs.svg?branch=develop)](https://travis-ci.org/rosette-api/nodejs)
6+
[![npm version](https://badge.fury.io/js/rosette-api.svg)](https://badge.fury.io/js/rosette-api)
7+
![node engine](https://img.shields.io/node/v/rosette-api.svg)
8+
9+
## Rosette API
10+
The Rosette Text Analytics Platform uses natural language processing, statistical modeling, and machine learning to
11+
analyze unstructured and semi-structured text across 364 language-encoding-script combinations, revealing valuable
12+
information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and
13+
comparing the similarity of names, categorizing and adding linguistic tags to text and more.
14+
15+
## Rosette API Access
16+
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
17+
- Rosette Enterprise [Evaluation](https://www.rosette.com/product-eval/)
18+
19+
## Quick Start
20+
21+
#### Installation
22+
`npm install rosette-api`
23+
24+
#### Examples
25+
View small example programs for each Rosette endpoint in the [examples](https://github.com/rosette-api/nodejs/tree/develop/examples) directory.
26+
27+
#### Documentation & Support
28+
- [Binding API](https://rosette-api.github.io/nodejs/)
29+
- [Rosette Platform API](https://developer.rosette.com/features-and-functions)
30+
- [Binding Release Notes](https://github.com/rosette-api/nodejs/wiki/Release-Notes)
31+
- [Rosette Platform Release Notes](https://support.rosette.com/hc/en-us/articles/360018354971-Release-Notes)
32+
- [Binding/Rosette Platform Compatibility](https://developer.rosette.com/features-and-functions?javascript#)
33+
- [Support](https://support.rosette.com)
34+
- [Binding License: Apache 2.0](https://github.com/rosette-api/nodejs/blob/develop/LICENSE.txt)
35+
36+
## Binding Developer Information
37+
If you are modifying the binding code, please refer to the [developer README](https://github.com/rosette-api/nodejs/blob/develop/DEVELOPER.md) file.

Diff for: examples/Dockerfile

-18
This file was deleted.

Diff for: examples/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Endpoint Examples
2+
Each example file demonstrates one of the capabilities of the Rosette Platform.
3+
4+
Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for
5+
overriding the default URL.
6+
7+
A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it.
8+
9+
#### Docker/Latest Release
10+
```
11+
git clone [email protected]:rosette-api/nodejs.git
12+
cd nodejs/examples
13+
docker run -it --entrypoint sh -v $(pwd):/examples node:12-alpine
14+
cd /examples
15+
npm install rosette-api argparse
16+
sed -i s',require("../lib/Api"),require("rosette-api"),' ping.js
17+
node ping.js --key $API_KEY
18+
```
19+
20+
#### Docker/Current Source
21+
```
22+
git clone [email protected]:rosette-api/nodejs.git
23+
cd nodejs
24+
docker run -it --entrypoint sh -v $(pwd):/source node:12-alpine
25+
cd /source
26+
npm install
27+
cd examples
28+
node ping.js --key $API_KEY
29+
```

Diff for: examples/address_similarity.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
3+
var Api = require("../lib/Api");
4+
var ArgumentParser = require("argparse").ArgumentParser;
5+
6+
var parser = new ArgumentParser({
7+
addHelp: true,
8+
description: "Get the similarity score of two names"
9+
});
10+
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
11+
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
12+
var args = parser.parseArgs();
13+
var api = new Api(args.key, args.url);
14+
var endpoint = "addressSimilarity";
15+
16+
api.parameters.address1 = {"city": "Cambridge"}
17+
api.parameters.address2 = {"city": "cambridge", "state": "ma"}
18+
19+
api.rosette(endpoint, function(err, res){
20+
if(err){
21+
console.log(err);
22+
} else {
23+
console.log(JSON.stringify(res, null, 2));
24+
}
25+
});

Diff for: examples/runAll.sh

-114
This file was deleted.

Diff for: lib/Api.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Rosette API.
33
*
4-
* @copyright 2016-2018 Basis Technology Corporation.
4+
* @copyright 2016-2019 Basis Technology Corporation.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
77
* with the License. You may obtain a copy of the License at
@@ -21,6 +21,7 @@ var rosetteConstants = require("./rosetteConstants");
2121
var RosetteException = require("./rosetteExceptions");
2222
var paramObj = require("./parameters");
2323

24+
var addressSimilarity = require("./addressSimilarity")
2425
var categories = require("./categories");
2526
var entities = require("./entities");
2627
var info = require("./info");

0 commit comments

Comments
 (0)