1. Learn
  2. /
  3. Courses
  4. /
  5. Deploying AI into Production with FastAPI

Connected

Exercise

Handle textual request data

Another requirement in the content moderation system is to take into account user comments' sentiment. The system needs to identify specific problematic phrases to help moderators review potentially inappropriate content.

You'll create an endpoint that analyzes text coming from users and extracts standardized moderation flags.

Instructions

100 XP
  • Turn the incoming text into lowercase in the analyze_comment() function to make it case-insensitive.
  • Extract problem keywords in found_issues from the processed text using the problem_keywords list.
  • Return a JSON response with the following keys - issues (list of keywords), issue_count (integer), and the original_text (string).