Overview
The emotion prediction API provides 6 distinct toxicity categories to help you identify and moderate inappropriate content. Each category uses a threshold of 0.29 to determine if content should be flagged.Toxicity Categories
The API classifies text across six categories:Toxic
General toxic language or rude comments
Severe Toxic
Extremely toxic content with strong offensive language
Obscene
Profanity, vulgar, or sexually explicit content
Threat
Threatening language or intimidation
Insult
Personal insults or attacks
Identity Hate
Hate speech targeting identity groups
How It Works
The API analyzes text and returns predictions for each category. Content is flagged when the model’s confidence exceeds the 0.29 threshold (see microservice.py:206-211).Inappropriate Content Detection
Content is marked as inappropriate when ALL six toxicity categories are flagged simultaneously (microservice.py:219):API Usage
Basic Request
Example Response
The API returns classification results for each category:Use Case Scenarios
Social Media Platform
Filter toxic comments in real-time before they appear publicly. Flag content for human review when multiple categories are triggered.
Community Forums
Automatically moderate forum posts and threads. Create different moderation levels based on which toxicity categories are detected.
Customer Support
Monitor customer messages to identify abusive language directed at support staff. Escalate severe cases automatically.
Content Publishing
Screen user submissions before publication. Maintain brand safety by preventing inappropriate content from going live.
Implementation Example
Automated Moderation System
Multi-tier Moderation
Best Practices
Moderation Guidelines
- Combine with human review: Use the API for initial filtering, but have humans review edge cases
- Set appropriate thresholds: The default 0.29 threshold works well, but adjust based on your use case
- Monitor false positives: Track incorrectly flagged content to improve your moderation workflow
- Provide user feedback: Let users know why content was flagged and give them a chance to edit
- Log all decisions: Keep records of moderation actions for transparency and appeals
Next Steps
- Learn how to use Sentiment Analysis for positive/negative emotion detection
- Explore the API’s entity extraction features for dates, countries, and people names