feat: Human-Readable Emotion Analysis Summary Generator#11
Open
cc-fuyu wants to merge 1 commit into
Open
Conversation
Introduce a summary generator module that converts raw emotion percentages into natural-language summaries for non-technical stakeholders (UX researchers, designers, product managers). Key additions: - services/report/summary_generator.py: Core module with EmotionBreakdown dataclass, sentiment classification, top-emotion sentence builder, and UX insight generator - routes/video_routes.py: New POST /process_video_summary endpoint that returns both raw emotions and a human-readable summary - tests/test_summary_generator.py: 15 unit tests covering EmotionBreakdown, sentiment labeling, and full summary generation The summary includes: - overall_sentiment: Positive/Negative/Mixed/Neutral label - top_emotions: Natural-language sentence about top 3 emotions - ux_insight: Brief UX-oriented interpretation - full_summary: Combined paragraph suitable for reports This addresses the 'Human-Readable Report Summaries' key feature of the GSoC 'Sentiment and Emotion Output Standardization' project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a human-readable summary generator that converts raw emotion analysis percentages into natural-language text. It directly addresses the "Human-Readable Report Summaries" key feature of the GSoC 2026 project "Sentiment and Emotion Output Standardization for Usability Reports".
Problem
The current API returns only numerical percentages (e.g.,
{"Happy": 35.0, "Sad": 10.0, ...}). While precise, these raw numbers require interpretation effort from non-technical stakeholders such as UX researchers, designers, and product managers.Changes
New Module:
services/report/summary_generator.pyA pure-Python module (no external dependencies) that provides:
EmotionBreakdowndominant_emotion,positive_total,negative_total,neutral_total,top_n()_sentiment_label()_top_emotions_sentence()_ux_insight()generate_summary()overall_sentiment,top_emotions,ux_insight, andfull_summaryNew Endpoint:
POST /process_video_summaryReturns both raw emotion percentages and the generated summary in a single response.
Example Response
{ "emotions": {"Happy": 55.0, "Neutral": 20.0, "Surprised": 10.0, ...}, "summary": { "overall_sentiment": "Mostly Positive", "top_emotions": "The top emotions were happiness (55.0%), neutral affect (20.0%), and surprise (10.0%).", "ux_insight": "The overall emotional response was positive, suggesting that users found the experience engaging or satisfying.", "full_summary": "Analysis of \"session_42.webm\": The overall emotional sentiment is **Mostly Positive**. The top emotions were happiness (55.0%), neutral affect (20.0%), and surprise (10.0%). The overall emotional response was positive, suggesting that users found the experience engaging or satisfying." } }Unit Tests:
tests/test_summary_generator.py15 tests covering:
EmotionBreakdowncomputed propertiesAll tests pass:
15 passed in 0.04sBackward Compatibility
The original
/process_videoendpoint is not modified. The new/process_video_summaryendpoint is purely additive.