Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "nlpcloud", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Node.js client for the NLP Cloud API. NLP Cloud serves all the spaCy pre-trained models, and your own custom models, through a RESTful API ready for production.\n\nMore details here: https://nlpcloud.io\n\nDocumentation: https://docs.nlpcloud.io", | ||
"main": "nlpcloud.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
@@ -28,3 +28,6 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"homepage": "https://github.com/nlpcloud/nlpcloud-js#readme" | ||
"homepage": "https://github.com/nlpcloud/nlpcloud-js#readme", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
} | ||
} |
126
README.md
@@ -1,1 +0,125 @@ | ||
# Node.js Client For NLP Cloud | ||
# Node.js Client For NLP Cloud | ||
This is a Node.js client for the NLP Cloud API: https://docs.nlpcloud.io | ||
NLP Cloud serves all the spaCy pre-trained models, and your own custom models, through a RESTful API, so it's easy for you to use them in production. | ||
If you face an issue, don't hesitate to raise it as a Github issue. Thanks! | ||
## Installation | ||
Install via npm. | ||
```shell | ||
npm install nlpcloud | ||
``` | ||
## Examples | ||
Here is a full example that uses the `en_core_web_sm` model, with a fake token: | ||
```es6 | ||
import NLPCloud from 'nlpcloud' | ||
var client = new NLPCloud('en_core_web_sm','4eC39HqLyjWDarjtT1zdp7dc') | ||
client.entities("John Doe is a Go Developer at Google") | ||
.then((data) => { | ||
console.log(data); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); | ||
``` | ||
And a full example that uses your own custom model `7894`: | ||
```python | ||
import nlpcloud | ||
client = nlpcloud.Client("custom_model/7894", "4eC39HqLyjWDarjtT1zdp7dc") | ||
client.entities("John Doe is a Go Developer at Google") | ||
``` | ||
A json object is returned. Here is what it could look like: | ||
```json | ||
[ | ||
{ | ||
"end": 8, | ||
"start": 0, | ||
"text": "John Doe", | ||
"type": "PERSON" | ||
}, | ||
{ | ||
"end": 25, | ||
"start": 13, | ||
"text": "Go Developer", | ||
"type": "POSITION" | ||
}, | ||
{ | ||
"end": 35, | ||
"start": 30, | ||
"text": "Google", | ||
"type": "ORG" | ||
}, | ||
] | ||
``` | ||
## Usage | ||
### Client Initialization | ||
Pass the spaCy model you want to use and the NLP Cloud token to the client during initialization. | ||
The spaCy model can either be a spaCy pretrained model like `en_core_web_sm`, `fr_core_news_lg`... but also one of your custom spaCy models using `custom_model/<model id>` (e.g. `custom_model/2568`). | ||
Your token can be retrieved from your [NLP Cloud dashboard](https://nlpcloud.io/home/token). | ||
```python | ||
import nlpcloud | ||
client = nlpcloud.Client("<model>", "<your token>") | ||
``` | ||
### Entities Endpoint | ||
Call the `entities()` method and pass the text you want to perform named entity recognition (NER) on. | ||
```python | ||
client.entities("<Your block of text>") | ||
``` | ||
The above command returns a JSON object. | ||
### Dependencies Endpoint | ||
Call the `dependencies()` method and pass the text you want to perform part of speech tagging (POS) + arcs on. | ||
```python | ||
client.dependencies("<Your block of text>") | ||
``` | ||
The above command returns a JSON object. | ||
### Sentence Dependencies Endpoint | ||
Call the `sentence_dependencies()` method and pass a block of text made up of several sentencies you want to perform POS + arcs on. | ||
```python | ||
client.sentence_dependencies("<Your block of text>") | ||
``` | ||
The above command returns a JSON object. | ||
### Library Versions Endpoint | ||
Call the `lib_versions()` method to know the versions of the libraries used behind the hood with the model (for example the spaCy version used). | ||
```python | ||
client.lib_versions() | ||
``` | ||
The above command returns a JSON object. | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8086
76
126
1
+ Addedaxios@^0.21.1
+ Addedaxios@0.21.4(transitive)
+ Addedfollow-redirects@1.15.9(transitive)