Skip to content

Commit d7729fb

Browse files
committed
Support target in sentiment analysis
1 parent 1bc635d commit d7729fb

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ client.langdetection({text:'<The text you want to analyze>'})
302302
Call the `question()` method and pass the following:
303303
304304
1. Your question
305-
1. A context that the model will use to try to answer your question
305+
1. (Optional) A context that the model will use to try to answer your question
306306
307307
```js
308308
client.question({question:'<Your question>', context:'<Your context>'})
@@ -338,10 +338,13 @@ client.sentenceDependencies({text:'<Your block of text>'})
338338
339339
### Sentiment Analysis Endpoint
340340
341-
Call the `sentiment()` method and pass the text you want to analyze the sentiment of:
341+
Call the `sentiment()` method and pass the following:
342+
343+
1. The text you want to get the sentiment of
344+
1. (Optional) The target element that the sentiment should apply to
342345
343346
```js
344-
client.sentiment({text:'<Your block of text>'})
347+
client.sentiment({text:'<Your block of text>', target:'<Your target>'})
345348
```
346349
347350
### Speech Synthesis Endpoint

dist/index.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ declare class Client {
267267
}>;
268268

269269
sentiment(params: {
270-
text: string
270+
text: string,
271+
target?: string
271272
}): Promise<{
272273
status: number;
273274
statusText: string;

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ class Client {
281281

282282
sentiment(params) {
283283
var text = params.text
284-
284+
var target = params.target ?? null
285285
const payload = {
286-
'text': text
286+
'text': text,
287+
'target': target
287288
};
288289

289290
return axios.post(this.rootURL + '/' + 'sentiment', payload, { headers: this.headers })

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nlpcloud",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"description": "NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, text generation, image generation, code generation, question answering, automatic speech recognition, machine translation, language detection, semantic search, semantic similarity, tokenization, POS tagging, speech synthesis, 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.com\n\nDocumentation: https://docs.nlpcloud.com",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)