Comparing version 1.0.9 to 1.0.10
28
index.js
@@ -7,7 +7,13 @@ const axios = require('axios') | ||
class Client { | ||
constructor(model, token) { | ||
constructor(model, token, gpu = false) { | ||
this.headers = { | ||
'Authorization': 'Token ' + token | ||
'Authorization': 'Token ' + token, | ||
'User-Agent': "nlploud-javascript-client" | ||
} | ||
this.rootURL = BASE_URL + '/' + API_VERSION + '/' + model | ||
if (gpu) { | ||
this.rootURL = BASE_URL + '/' + API_VERSION + '/gpu/' + model | ||
} else { | ||
this.rootURL = BASE_URL + '/' + API_VERSION + '/' + model | ||
} | ||
} | ||
@@ -66,2 +72,18 @@ | ||
langdetection(text) { | ||
const payload = { | ||
'text': text | ||
}; | ||
return axios.post(this.rootURL + '/' + 'langdetection', payload, { headers: this.headers }) | ||
} | ||
tokens(text) { | ||
const payload = { | ||
'text': text | ||
}; | ||
return axios.post(this.rootURL + '/' + 'tokens', payload, { headers: this.headers }) | ||
} | ||
dependencies(text) { | ||
@@ -68,0 +90,0 @@ const payload = { |
{ | ||
"name": "nlpcloud", | ||
"version": "1.0.9", | ||
"description": "Node.js client for the NLP Cloud API. NLP Cloud serves high performance pre-trained and custom models for NER, sentiment-analysis, classification, summarization, question answering, and POS tagging, ready for production, served through a REST API.\n\nMore details here: https://nlpcloud.io\n\nDocumentation: https://docs.nlpcloud.io", | ||
"version": "1.0.10", | ||
"description": "NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, text generation, question answering, machine translation, language detection, tokenization, POS tagging, and dependency parsing. It is ready for production, served through a REST API.\n\nThis is the Node.js client for the NLP Cloud API.\n\nMore details here: https://nlpcloud.io\n\nDocumentation: https://docs.nlpcloud.io", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -5,3 +5,3 @@ # Node.js Client For NLP Cloud | ||
NLP Cloud serves high performance pre-trained models for NER, sentiment-analysis, classification, summarization, question answering, and POS tagging, ready for production, served through a REST API. | ||
NLP Cloud serves high performance pre-trained for NER, sentiment-analysis, classification, summarization, text generation, question answering, machine translation, language detection, tokenization, POS tagging, and dependency parsing. It is ready for production, served through a REST API. | ||
@@ -100,5 +100,13 @@ Pre-trained models are the spaCy models and some transformers-based models from Hugging Face. You can also deploy your own transformers-based models, or spaCy models. | ||
const client = new NLPCloudClient('en_core_web_sm','4eC39HqLyjWDarjtT1zdp7dc') | ||
const client = new NLPCloudClient('<model>','<your token>') | ||
``` | ||
If you want to use a GPU, pass `gpu = true`. | ||
```js | ||
const NLPCloudClient = require('nlpcloud'); | ||
const client = new NLPCloudClient("<model>", "<your token>", gpu = true) | ||
``` | ||
### Entities Endpoint | ||
@@ -147,4 +155,2 @@ | ||
**Note that your block of text should not exceed 1024 words, otherwise you will get an error. Also note that this model works best for blocks of text between 56 and 142 words.** | ||
```js | ||
@@ -162,2 +168,18 @@ client.summarization("<Your text to summarize>") | ||
### Language Detection Endpoint | ||
Call the `langdetection()` method and pass the text you want to analyze in order to detect the languages. | ||
```js | ||
client.langdetection("<The text you want to analyze>") | ||
``` | ||
### Tokenization Endpoint | ||
Call the `tokens()` method and pass the text you want to tokenize. | ||
```js | ||
client.tokens("<Your block of text>") | ||
``` | ||
### Dependencies Endpoint | ||
@@ -164,0 +186,0 @@ |
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
11730
106
205