Vulavula Analyse
Sentiment Analysis
POST
https://vulavula-services.lelapa.ai/api/v1/sentiment_analysis/process.
The Sentiment endpoint analyzes the provided text and returns the emotional tone as positive, negative, or neutral. Each request can handle up to 2,000 tokens, with a recommended limit of 180 tokens for optimal performance.
BODY PARAMS
encoded_text string required.
This parameter represents the text input that will be analyzed for named entities. It is required for the endpoint to function properly. The encoded_text
should be provided as a string and contains the text to be processed by the Sentiment model.
HEADERS
X-CLIENT-TOKEN string required.
Represents the authentication token required for accessing the API. This header ensures that only authorized clients can make requests to the endpoint.
EXAMPLES
- Python SDK
- Python HTTP
- Curl
pdm add vulavula
from vulavula import VulavulaClient
client = VulavulaClient("<INSERT_TOKEN>")
sentiment_result = client.get_sentiments({'encoded_text': 'am happy. i am sad. hello!'})
print(sentiment_result)
# Endpoint URL
url = 'https://vulavula-services.lelapa.ai/api/v1/sentiment_analysis/process'
# Headers
headers = {
'Content-Type': 'application/json',
'X-CLIENT-TOKEN': '<INSERT_TOKEN>' # Replace '<INSERT_TOKEN>' with your actual client token
}
# Request body
data = {
"encoded_text": "am happy. i am sad. hello"
}
# Sending POST request
response = requests.post(url, headers=headers, json=data)
# Printing response
print(response.json())
curl -X 'POST' \
'https://vulavula-services.lelapa.ai/api/v1/sentiment_analysis/process' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"encoded_text": "am happy. i am sad. hello"
}'
RESPONSES
🟢 200 OK
{
"Id": "a9529bd6-35c9-406b-ae01-f7c9cd95cf54",
"Sentiments": [
{
"text": "am happy",
"sentiment": [
{
"label": "positive",
"score": 0.9991829991340637
}
]
},
{
"text": " i am sad",
"sentiment": [
{
"label": "negative",
"score": 0.960746169090271
}
]
},
{
"text": " hello",
"sentiment": [
{
"label": "neutral",
"score": 0.8527688384056091
}
]
}
]
}
RESPONSE BODY PARAMS
Object |
---|
Sentiments string required. Sentences seperated by (. and !) and returned as a list of sentiments |
sentiment obj required. Object with the response analysed for each of the sentences |
text string required. Contains text which makes up each of the sentences |
label string required. Indicates the sentiment returned by the Model for each sentence |
score number required. Model confidence that the answer is of that specific Sentiment |