Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nlpcloud

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlpcloud - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

103

dist/index.d.ts

@@ -9,9 +9,18 @@ export = Client;

rootURL: string;
entities(text: string): Promise<{
adGeneration(keywords: string[]): Promise<{
status: number;
statusText: string;
data: {
entities: { start: number; end: number; type: string; text: string }[];
generated_text: string;
};
}>;
chatbot(input: string, history: { input: string, response: string }[]): Promise<{
status: number;
statusText: string;
data: {
response: string;
history: { input: string, response: string }[];
};
}>;
classification(text: string, labels: string[], multiClass?: boolean): Promise<{

@@ -25,2 +34,23 @@ status: number;

}>;
dependencies(text: string): Promise<{
status: number;
statusText: string;
data: {
words: { text: string, tag: string }[];
};
}>;
embeddings(text: string[]): Promise<{
status: number;
statusText: string;
data: {
score: number[][];
};
}>;
entities(text: string): Promise<{
status: number;
statusText: string;
data: {
entities: { start: number; end: number; type: string; text: string }[];
};
}>;
generation(text: string, minLength?: number, maxLength?: number, lengthNoInput?: boolean, endSequence?: string, removeInput?: boolean, doSample?: boolean, numBeams?: number, earlyStopping?: boolean, noRepeatNgramSize?: number, numReturnSequences?: number, topK?: number, topP?: number, temperature?: number, repetitionPenalty?: number, lengthPenalty?: number, badWords?: string[], removeEndSequence?: boolean): Promise<{

@@ -33,10 +63,43 @@ status: number;

};
}>;;
sentiment(text: string): Promise<{
}>;
gsCorrection(text: string): Promise<{
status: number;
statusText: string;
data: {
scored_labels: { label: string, score: number }[];
correction: string;
};
}>;
intentClassification(text: string): Promise<{
status: number;
statusText: string;
data: {
intent: string;
};
}>;
kwKpExtraction(text: string): Promise<{
status: number;
statusText: string;
data: {
keywords_and_keyphrases: string[];
};
}>;
langdetection(text: string): Promise<{
status: number;
statusText: string;
data: {
languages: any[];
};
}>;
libVersions(): Promise<{
status: number;
statusText: string;
data: any;
}>;
paraphrasing(text: string): Promise<{
status: number;
statusText: string;
data: {
paraphrased_text: string;
};
}>;
question(context: string, question: string): Promise<{

@@ -52,49 +115,45 @@ status: number;

}>;
summarization(text: string): Promise<{
semanticSimilarity(text: string[]): Promise<{
status: number;
statusText: string;
data: {
summary_text: string;
score: number;
};
}>;
translation(text: string): Promise<{
sentenceDependencies(text: string): Promise<{
status: number;
statusText: string;
data: {
translation_text: string;
sentence_dependencies: { sentence: string, dependencies: { words: { text: string, tag: string }[], arcs: { start: number, end: number, label: string, text: string, dir: string }[] } }[];
};
}>;
langdetection(text: string): Promise<{
sentiment(text: string): Promise<{
status: number;
statusText: string;
data: {
languages: any[];
scored_labels: { label: string, score: number }[];
};
}>;
tokens(text: string): Promise<{
summarization(text: string): Promise<{
status: number;
statusText: string;
data: {
tokens: { start: number, end: number, index: number, text: string, lemma: string, ws_after: boolean }[];
summary_text: string;
};
}>;
dependencies(text: string): Promise<{
translation(text: string): Promise<{
status: number;
statusText: string;
data: {
words: { text: string, tag: string }[];
translation_text: string;
};
}>;
sentenceDependencies(text: string): Promise<{
tokens(text: string): Promise<{
status: number;
statusText: string;
data: {
sentence_dependencies: { sentence: string, dependencies: { words: { text: string, tag: string }[], arcs: { start: number, end: number, label: string, text: string, dir: string }[] } }[];
tokens: { start: number, end: number, index: number, text: string, lemma: string, ws_after: boolean }[];
};
}>;
libVersions(): Promise<{
status: number;
statusText: string;
data: any;
}>;
}

@@ -27,11 +27,20 @@ const axios = require('axios')

entities(text, searchedEntity = null) {
adGeneration(keywords) {
const payload = {
'text': text,
'searchedEntity': searchedEntity
'keywords': keywords
};
return axios.post(this.rootURL + '/' + 'entities', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'ad-generation', payload, { headers: this.headers })
}
chatbot(input, history = null) {
const payload = {
'input': input,
'history': history
};
return axios.post(this.rootURL + '/' + 'chatbot', payload, { headers: this.headers })
}
classification(text, labels = null, multiClass = null) {

@@ -47,2 +56,27 @@ const payload = {

dependencies(text) {
const payload = {
'text': text
};
return axios.post(this.rootURL + '/' + 'dependencies', payload, { headers: this.headers })
}
embeddings(sentences) {
const payload = {
'sentences': sentences
};
return axios.post(this.rootURL + '/' + 'embeddings', payload, { headers: this.headers })
}
entities(text, searchedEntity = null) {
const payload = {
'text': text,
'searchedEntity': searchedEntity
};
return axios.post(this.rootURL + '/' + 'entities', payload, { headers: this.headers })
}
generation(text, minLength = null, maxLength = null, lengthNoInput = null,

@@ -76,3 +110,3 @@ endSequence = null, removeInput = null, doSample = null, numBeams = null, earlyStopping = null,

sentiment(text) {
gsCorrection(text) {
const payload = {

@@ -82,15 +116,14 @@ 'text': text

return axios.post(this.rootURL + '/' + 'sentiment', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'gs-correction', payload, { headers: this.headers })
}
question(question, context = null) {
intentClassification(text) {
const payload = {
'question': question,
'context': context
'text': text
};
return axios.post(this.rootURL + '/' + 'question', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'intent-classification', payload, { headers: this.headers })
}
summarization(text) {
kwKpExtraction(text) {
const payload = {

@@ -100,6 +133,6 @@ 'text': text

return axios.post(this.rootURL + '/' + 'summarization', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'kw-kp-extraction', payload, { headers: this.headers })
}
paraphrasing(text) {
langdetection(text) {
const payload = {

@@ -109,6 +142,11 @@ 'text': text

return axios.post(this.rootURL + '/' + 'paraphrasing', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'langdetection', payload, { headers: this.headers })
}
translation(text) {
libVersions() {
return axios.get(this.rootURL + '/' + 'versions', { headers: this.headers })
}
paraphrasing(text) {
const payload = {

@@ -118,11 +156,12 @@ 'text': text

return axios.post(this.rootURL + '/' + 'translation', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'paraphrasing', payload, { headers: this.headers })
}
langdetection(text) {
question(question, context = null) {
const payload = {
'text': text
'question': question,
'context': context
};
return axios.post(this.rootURL + '/' + 'langdetection', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'question', payload, { headers: this.headers })
}

@@ -138,3 +177,3 @@

tokens(text) {
sentenceDependencies(text) {
const payload = {

@@ -144,6 +183,6 @@ 'text': text

return axios.post(this.rootURL + '/' + 'tokens', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'sentence-dependencies', payload, { headers: this.headers })
}
dependencies(text) {
sentiment(text) {
const payload = {

@@ -153,6 +192,6 @@ 'text': text

return axios.post(this.rootURL + '/' + 'dependencies', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'sentiment', payload, { headers: this.headers })
}
sentenceDependencies(text) {
summarization(text) {
const payload = {

@@ -162,18 +201,23 @@ 'text': text

return axios.post(this.rootURL + '/' + 'sentence-dependencies', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'summarization', payload, { headers: this.headers })
}
embeddings(sentences) {
tokens(text) {
const payload = {
'sentences': sentences
'text': text
};
return axios.post(this.rootURL + '/' + 'embeddings', payload, { headers: this.headers })
return axios.post(this.rootURL + '/' + 'tokens', payload, { headers: this.headers })
}
libVersions() {
return axios.get(this.rootURL + '/' + 'versions', { headers: this.headers })
translation(text) {
const payload = {
'text': text
};
return axios.post(this.rootURL + '/' + 'translation', payload, { headers: this.headers })
}
}
module.exports = Client
{
"name": "nlpcloud",
"version": "1.0.20",
"version": "1.0.21",
"description": "NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, text generation, question answering, machine translation, language detection, semantic similarity, tokenization, POS tagging, embeddings, 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",

@@ -5,0 +5,0 @@ "main": "index.js",

# Node.js Client For NLP Cloud
This is the Node.js client for the [NLP Cloud](https://nlpcloud.io) API. See the [documentation](https://docs.nlpcloud.io) for more details.
This is the Node.js client (with Typescript types) for the [NLP Cloud](https://nlpcloud.io) API. See the [documentation](https://docs.nlpcloud.io) for more details.
NLP Cloud serves high performance pre-trained for NER, sentiment-analysis, classification, summarization, text generation, question answering, machine translation, language detection, tokenization, lemmatization, POS tagging, and dependency parsing. It is ready for production, served through a REST API.
NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, intent classification, product description and ad generation, chatbot, grammar and spelling correction, keywords and keyphrases extraction, text generation, question answering, machine translation, language detection, semantic similarity, tokenization, POS tagging, embeddings, and dependency parsing. production, served through a REST API.

@@ -118,10 +118,21 @@ You can either use the NLP Cloud pre-trained models, fine-tune your own models, or deploy your own models.

### Entities Endpoint
### Ad Generation and Product Description Generation Endpoint
Call the `entities()` method and pass the text you want to perform named entity recognition (NER) on.
Call the `adGeneration()` method and pass the keywords you want to use to generate your ad or product description.
```js
client.entities("<Your block of text>")
client.adGeneration(["keyword 1", "keyword 2", ...])
```
### Chatbot/Conversational AI Endpoint
Call the `chatbot()` method and pass the following arguments:
1. Your input
1. (Optional) `history` The history of your previous exchanges with the model
```js
client.chatbot("<Your input>")
```
### Classification Endpoint

@@ -136,7 +147,33 @@

```js
client.classification("<Your block of text>", ["label 1", "label 2", "..."])
client.classification("<Your block of text>", ["label 1", "label 2", ...])
```
### Text Generation Endpoint
### Dependencies Endpoint
Call the `dependencies()` method and pass the text you want to perform part of speech tagging (POS) + arcs on.
```js
client.dependencies("<Your block of text>")
```
### Embeddings Endpoint
Call the `embeddings()` method and pass an array of blocks of text that you want to extract embeddings from.
```js
client.embeddings(["<Text 1>", "<Text 2>", "<Text 3>", ...])
```
The above command returns a JSON object.
### Entities Endpoint
Call the `entities()` method and pass the text you want to perform named entity recognition (NER) on.
```js
client.entities("<Your block of text>")
```
### Generation Endpoint
Call the `generation()` method and pass the following arguments:

@@ -167,51 +204,51 @@

### Sentiment Analysis Endpoint
### Grammar and Spelling Correction Endpoint
Call the `sentiment()` method and pass the text you want to analyze the sentiment of:
Call the `gsCorrection()` method and pass the text you want to correct.
```js
client.sentiment("<Your block of text>")
client.gsCorrection("<The text you want to correct>")
```
### Question Answering Endpoint
### Intent Classification Endpoint
Call the `question()` method and pass the following:
Call the `intentClassification()` method and pass the text you want to analyze in order to detect the intent.
1. Your question
1. A context that the model will use to try to answer your question
```js
client.question("<Your question>","<Your context>")
client.intentClassification("<The text you want to analyze>")
```
### Summarization Endpoint
### Keywords and Keyphrases Extraction Endpoint
Call the `summarization()` method and pass the text you want to summarize.
Call the `kwKpExtraction()` method and pass the text you want to extract keywords and keyphrases from.
```js
client.summarization("<Your text to summarize>")
client.kwKpExtraction("<The text you want to analyze>")
```
### Paraphrasing Endpoint
### Language Detection Endpoint
Call the `paraphrasing()` method and pass the text you want to paraphrase.
Call the `langdetection()` method and pass the text you want to analyze in order to detect the languages.
```js
client.paraphrasing("<Your text to paraphrase>")
client.langdetection("<The text you want to analyze>")
```
### Translation Endpoint
### Library Versions Endpoint
Call the `translation()` method and pass the text you want to translate.
Call the `libVersions()` method to know the versions of the libraries used behind the hood with the model (for example the PyTorch, TensorFlow, or spaCy version used).
```js
client.translation("<Your text to translate>")
client.libVersions()
```
### Language Detection Endpoint
### Question Answering Endpoint
Call the `langdetection()` method and pass the text you want to analyze in order to detect the languages.
Call the `question()` method and pass the following:
1. Your question
1. A context that the model will use to try to answer your question
```js
client.langdetection("<The text you want to analyze>")
client.question("<Your question>","<Your context>")
```

@@ -229,42 +266,48 @@

### Tokenization Endpoint
### Sentence Dependencies Endpoint
Call the `tokens()` method and pass the text you want to tokenize.
Call the `sentenceDependencies()` method and pass a block of text made up of several sentencies you want to perform POS + arcs on.
```js
client.tokens("<Your block of text>")
client.sentenceDependencies("<Your block of text>")
```
### Dependencies Endpoint
### Sentiment Analysis Endpoint
Call the `dependencies()` method and pass the text you want to perform part of speech tagging (POS) + arcs on.
Call the `sentiment()` method and pass the text you want to analyze the sentiment of:
```js
client.dependencies("<Your block of text>")
client.sentiment("<Your block of text>")
```
### Sentence Dependencies Endpoint
### Summarization Endpoint
Call the `sentenceDependencies()` method and pass a block of text made up of several sentencies you want to perform POS + arcs on.
Call the `summarization()` method and pass the text you want to summarize.
```js
client.sentenceDependencies("<Your block of text>")
client.summarization("<Your text to summarize>")
```
### Embeddings Endpoint
### Paraphrasing Endpoint
Call the `embeddings()` method and pass an array of blocks of text that you want to extract embeddings from.
Call the `paraphrasing()` method and pass the text you want to paraphrase.
```js
client.embeddings(["<Text 1>", "<Text 2>", "<Tex 3>", ...])
client.paraphrasing("<Your text to paraphrase>")
```
The above command returns a JSON object.
### Tokenization Endpoint
### Library Versions Endpoint
Call the `tokens()` method and pass the text you want to tokenize.
Call the `libVersions()` method to know the versions of the libraries used behind the hood with the model (for example the PyTorch, TensorFlow, or spaCy version used).
```js
client.tokens("<Your block of text>")
```
### Translation Endpoint
Call the `translation()` method and pass the text you want to translate.
```js
client.libVersions()
client.translation("<Your text to translate>")
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc