Skip to content

Sentiment Analysis

Social Scout v0.6.0 adds optional sentiment scoring to the preprocessing step and a dedicated Sentiment & Perception section in the dashboard.


Overview

Sentiment analysis assigns each cleaned post/comment a label and a confidence score:

Column Type Values
sentiment_label string positive, neutral, negative
sentiment_score float 0.0 – 1.0 (confidence)

The default model is cardiffnlp/twitter-roberta-base-sentiment-latest, a RoBERTa-based classifier fine-tuned on Twitter/social media text.


Running sentiment analysis

In the preprocess step

scout preprocess agentic-commerce --sentiment

This adds sentiment_label and sentiment_score to cleaned_data.parquet.

In the full pipeline

scout run agentic-commerce \
  --keywords "agentic commerce,AI shopping" \
  --all-techniques \
  --sentiment

Checking the result

scout project info agentic-commerce
# Shows: sentiment_enabled: true

Optional dependency

Sentiment analysis requires transformers (already a core dependency). If transformers is not installed, preprocessing completes without sentiment columns.


Dashboard: Sentiment & Perception section

When sentiment data is present in cleaned_data.parquet, scout visualize automatically includes a Sentiment & Perception section with six charts:

1. Sentiment Distribution (donut)

Shows the proportion of positive, neutral, and negative posts/comments overall.

2. Sentiment by Topic (heatmap)

Average sentiment_score for each topic. Topics with high scores are perceived positively by the community; topics with low scores have negative associations.

3. Controversy by Topic (bar chart)

Standard deviation of sentiment_score per topic. High deviation = divided opinion. Topics near the top are more polarising.

4. Sentiment Over Time (line chart)

Tracks how the proportion of each sentiment label changes week by week. Useful for spotting events that shifted community sentiment.

5. Community × Sentiment (heatmap)

Compares sentiment distributions across subreddits. A subreddit dominant in "negative" may indicate concern or criticism that differs from more optimistic communities.

6. Perception Map (scatter)

Each topic plotted by average sentiment (x-axis) vs. total post volume (y-axis). Bubbles sized by volume. Topics in the upper-right are high-volume and positively received.


Visualization report

Export charts as PNG and generate a structured Markdown report:

scout visualize agentic-commerce \
  --export-png \
  --interpret \
  --report-language korean

This writes three outputs to projects/agentic-commerce/visualizations/:

File Description
dashboard.html Interactive HTML dashboard (always generated)
charts/{section}/{chart}.png High-resolution PNGs (requires --export-png)
visualization_report.md Markdown report with interpretations + image links
interpretations.json Raw LLM interpretation text, section-keyed

Example visualization_report.md excerpt

## Sentiment & Perception

> 감성분석 결과, 긍정 반응이 52%로 우세하지만 '아젠틱 커머스' 토픽에서
> 논쟁성이 높아 커뮤니티 내 의견 분열이 관찰됩니다.

![Sentiment Distribution](charts/sentiment-perception/sentiment-distribution.png)
![Sentiment by Topic](charts/sentiment-perception/sentiment-by-topic.png)
![Controversy by Topic](charts/sentiment-perception/controversy-by-topic.png)

PNG export requirements

High-resolution PNG export requires kaleido:

pip install 'social-scout[viz]'
# or
pip install kaleido>=0.2.1

If kaleido is not installed, --export-png is silently skipped and a warning is logged.


Language options

Use --report-language korean to generate Korean-language LLM interpretations:

scout visualize agentic-commerce \
  --interpret \
  --report-language korean \
  --llm claude

Available: english (default), korean.