Skip to main content

Sentiment Analysis

API Documentation for Sentiment Analysis

Identifying sentiment expressed in text whether they’re negative, neutral, or positive.

Group

Negative
Neutral
Positive

Identifying sentiment expressed in text

POST https://apis.aigen.online/ainlp/sentiment/v1

Request Body

NameTypeDescription
text*String
{
"group_count": 1,
"group_detail": [
{
"group_name": "Positive",
"rank": 1,
"score": 0.82
}
],
"status": "success"
}

Example code

import requests
import json

api = "https://apis.aigen.online/ainlp/sentiment/v1"
headers = {"x-aigen-key": "<key>", "content-type": "application/json"}
data = json.dumps({"text": "ai สามารถช่วยแก้ปัญหาต่าง ๆ ได้"})

res = requests.post(api, data=data, headers=headers)
print(res.json())