-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
280 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.