Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-mg committed Oct 30, 2019
2 parents 2d23cb3 + 4e62168 commit 03ae0c8
Show file tree
Hide file tree
Showing 13 changed files with 280 additions and 236 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: node_js
# https://nodejs.org/en/about/releases/#releases
node_js:
- "6.15.1"
- "7.10.1"
- "8.14.0"
- "9.11.2"
- "10.14.1"
- "11.4.0"
- "8"
- "9"
- "10"
- "11"
- "12"
before_install:
- npm install -g npm
before_script:
Expand Down
43 changes: 43 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Binding Developer Info

#### Build and Release Instructions
TBD
Include notes on updating Travis test versions, keeping `package.json` fresh.
Maybe some notes on updating dependency versions, linting, dependency vulnerabilities, etc.
There appears to be some mixed whitespace that should be tidied up.


#### Old Docker Info From Examples
If we want to keep this, let's clean it up.

`runAll.sh` is testing a string instead of an http code.
`runAl.sh` and `Dockerfile` may need to be consolidated with the other example scripts.

Here are the old instructions from examples/README.

##### Docker
A Docker image for running the examples against the compiled source library is available on Docker Hub.

Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-nodejs`

Additional environment settings:
`-e ALT_URL=<alternative URL>`
`-e FILENAME=<single filename>`

##### Example using the Rosette API language detection endpoint
```javascript
var Api = require('rosette-api');

var api = new Api(API_KEY);
var endpoint = "language";
var content = "Por favor Señorita, says the man.";
api.parameters.content = content;

api.rosette(endpoint, function(err, res){
if(err){
console.log(err);
} else {
console.log(JSON.stringify(res, null, 2));
}
});
```
120 changes: 37 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,37 @@
[![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)

# rosette-api

This is the Rosette API client binding for node.js.

## Getting Started
Install the module with: `npm install rosette-api`

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`),
please check for its [**compatibilty with api.rosette.com**](https://developer.rosette.com/features-and-functions?javascript).
If you have an on-premise version of Rosette API server, please contact support for
binding compatibility with your installation.

To check your installed version:

- `npm list rosette-api` for local installation
- `npm list -g rosette-api` for global installation

https://www.npmjs.com/package/rosette-api

## Docker ##
A Docker image for running the examples against the compiled source library is available on Docker Hub.

Command: `docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-nodejs`

Additional environment settings:
`-e ALT_URL=<alternative URL>`
`-e FILENAME=<single filename>`


## Example using the Rosette API language detection endpoint
```javascript
var Api = require('rosette-api');

var api = new Api(API_KEY);
var endpoint = "language";
var content = "Por favor Señorita, says the man.";
api.parameters.content = content;

api.rosette(endpoint, function(err, res){
if(err){
console.log(err);
} else {
console.log(JSON.stringify(res, null, 2));
}
});
```
## API Parameters
| Parameter | Endpoint | Required
| ------------- |------------- |-------------
| content | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics, transliteration | Either content or contentUri required, transliteration requires content only |
| contentUri | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics | Either content or contentUri required |
| language | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics, name similarity | No |
| documentFile | categories, entities, language, morphology, relationships, sentences, sentiment, tokens, topics | No |
| name1 | name similarity | Yes |
| name2 | name similarity| Yes |
| name | name translation | Yes |
| names | name deduplication | Yes |
| targetLanguage | name translation, transliteration (No) | Yes |
| entityType | name translation | No |
| sourceLanguageOfOrigin | name translation | No |
| sourceLanguageOfUse | name translation | No |
| sourceLanguage | transliteration | No |
| sourceScript | name translation, transliteration | No |
| targetScript | name translation, transliteration | No |
| targetScheme | name translation | No |
| options | relationships | No |
| accuracyMode | relationships | Yes |
| explain | sentiment | No |
| morphology | morphology | Yes |

## Additional Examples
See [examples](examples).

## API Documentation
See [documentation](http://rosette-api.github.io/nodejs)

## Release Notes
See [wiki](https://github.com/rosette-api/nodejs/wiki/Release-Notes)

## Additional Information
See [Rosette API site](https://developer.rosette.com/)
<a href="https://www.rosette.com"><img src="https://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>

---

[![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)
![node engine](https://img.shields.io/node/v/rosette-api.svg)

## Rosette API
The Rosette Text Analytics Platform uses natural language processing, statistical modeling, and machine learning to
analyze unstructured and semi-structured text across 364 language-encoding-script combinations, revealing valuable
information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and
comparing the similarity of names, categorizing and adding linguistic tags to text and more.

## Rosette API Access
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
- Rosette Enterprise [Evaluation](https://www.rosette.com/product-eval/)

## Quick Start

#### Installation
`npm install rosette-api`

#### Examples
View small example programs for each Rosette endpoint in the [examples](https://github.com/rosette-api/nodejs/tree/develop/examples) directory.

#### Documentation & Support
- [Binding API](https://rosette-api.github.io/nodejs/)
- [Rosette Platform API](https://developer.rosette.com/features-and-functions)
- [Binding Release Notes](https://github.com/rosette-api/nodejs/wiki/Release-Notes)
- [Rosette Platform Release Notes](https://support.rosette.com/hc/en-us/articles/360018354971-Release-Notes)
- [Binding/Rosette Platform Compatibility](https://developer.rosette.com/features-and-functions?javascript#)
- [Support](https://support.rosette.com)
- [Binding License: Apache 2.0](https://github.com/rosette-api/nodejs/blob/develop/LICENSE.txt)

## Binding Developer Information
If you are modifying the binding code, please refer to the [developer README](https://github.com/rosette-api/nodejs/blob/develop/DEVELOPER.md) file.
18 changes: 0 additions & 18 deletions examples/Dockerfile

This file was deleted.

29 changes: 29 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Endpoint Examples
Each example file demonstrates one of the capabilities of the Rosette Platform.

Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for
overriding the default URL.

A note on prerequisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it.

#### Docker/Latest Release
```
git clone [email protected]:rosette-api/nodejs.git
cd nodejs/examples
docker run -it --entrypoint sh -v $(pwd):/examples node:12-alpine
cd /examples
npm install rosette-api argparse
sed -i s',require("../lib/Api"),require("rosette-api"),' ping.js
node ping.js --key $API_KEY
```

#### Docker/Current Source
```
git clone [email protected]:rosette-api/nodejs.git
cd nodejs
docker run -it --entrypoint sh -v $(pwd):/source node:12-alpine
cd /source
npm install
cd examples
node ping.js --key $API_KEY
```
25 changes: 25 additions & 0 deletions examples/address_similarity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

var Api = require("../lib/Api");
var ArgumentParser = require("argparse").ArgumentParser;

var parser = new ArgumentParser({
addHelp: true,
description: "Get the similarity score of two names"
});
parser.addArgument(["--key"], {help: "Rosette API key", required: true});
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false});
var args = parser.parseArgs();
var api = new Api(args.key, args.url);
var endpoint = "addressSimilarity";

api.parameters.address1 = {"city": "Cambridge"}
api.parameters.address2 = {"city": "cambridge", "state": "ma"}

api.rosette(endpoint, function(err, res){
if(err){
console.log(err);
} else {
console.log(JSON.stringify(res, null, 2));
}
});
114 changes: 0 additions & 114 deletions examples/runAll.sh

This file was deleted.

3 changes: 2 additions & 1 deletion lib/Api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Rosette API.
*
* @copyright 2016-2018 Basis Technology Corporation.
* @copyright 2016-2019 Basis Technology Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand All @@ -21,6 +21,7 @@ var rosetteConstants = require("./rosetteConstants");
var RosetteException = require("./rosetteExceptions");
var paramObj = require("./parameters");

var addressSimilarity = require("./addressSimilarity")
var categories = require("./categories");
var entities = require("./entities");
var info = require("./info");
Expand Down
Loading

0 comments on commit 03ae0c8

Please sign in to comment.