Skip to main content

Response Structure

The API returns an HTML page with the following fields rendered in the template:

Input Text

text
string
The original text that was analyzed.

Toxicity Results

toxic_result
string
Whether the text is toxic. Returns “Yes” or “No” based on a threshold of 0.29.
severe_toxic_result
string
Whether the text contains severely toxic language. Returns “Yes” or “No”.
obscene_result
string
Whether the text is obscene. Returns “Yes” or “No”.
threat_result
string
Whether the text contains threats. Returns “Yes” or “No”.
insult_result
string
Whether the text is insulting. Returns “Yes” or “No”.
identity_hate_result
string
Whether the text contains identity-based hate speech. Returns “Yes” or “No”.
inappropriate
boolean
True if ALL six toxicity categories return “Yes”, otherwise False.

Emotion Analysis

emotion
string
The detected emotion: “Positive” or “Negative”.If all toxicity flags are “Yes”, emotion is set to “Negative”. Otherwise, the emotion classifier predicts the sentiment.

Entity Extraction

countries
string
Comma-separated list of countries mentioned in the text. Extracted using country detection algorithms.
people
string
Comma-separated list of people names identified in the text. Country names and dates are filtered out from this field.
dates
string
Comma-separated list of dates found in the text.
hours
array
Array of time ranges found in the text, matching the pattern “HH:MM - HH:MM”.Each element is a tuple of (start_time, end_time).

Example Response

For the request:
curl "http://127.0.0.1:3200/textbased_emotion?text=Hello%20world%2C%20have%20a%20great%20day!"
The API would return an HTML page with fields like:
text: "Hello world, have a great day!"
toxic_result: "No"
severe_toxic_result: "No"
obscene_result: "No"
threat_result: "No"
insult_result: "No"
identity_hate_result: "No"
inappropriate: False
emotion: "Positive"
countries: ""
people: ""
dates: ""
hours: []

Toxicity Threshold

All toxicity classifications use a threshold of 0.29. When the model’s confidence score for a category exceeds this threshold, the result is “Yes”, otherwise “No”.

Build docs developers (and LLMs) love