This repository contains the code and data for Zhao et al. "Mapping the Spiral of Silence: Surveying Unspoken Opinions in Online Communities" to appear at CHI 2026.
spiral-of-silence/
├── generate_viewpoints.py # Script to generate topics and viewpoints using LLMs
├── utils.py # Utility functions for Reddit API and OpenAI API
├── paper_analyses.ipynb # Python notebook for data analysis and visualizations
├── Regression.Rmd # R markdown file for statistical modeling
├── data.csv # Survey data (participant responses)
├── prompts/ # LLM prompts for topic/viewpoint generation
│ ├── topic_1.json # Prompt for generating controversial topics
│ ├── viewpoint_1.json # Prompt for generating viewpoints on topics
│ └── summarize_1.json # Prompt for shortening viewpoints
└── README.md # This file
-
= Python 3.10
- R (for statistical analyses)
- Reddit API credentials
- OpenAI API key
- Clone this repository:
git clone <repository-url>
cd spiral-of-silence- Install Python dependencies:
pip install praw openai python-dotenv pandas tqdm numpy matplotlib scipy jupyter- Create a
.envfile in the root directory with your API credentials:
REDDIT_CLIENT=your_reddit_client_id
REDDIT_SECRET=your_reddit_secret
OPENAI_API=your_openai_api_key
The generate_viewpoints.py script generates controversial topics and corresponding viewpoints for specified Reddit subreddits:
from generate_viewpoints import main
# Generate topics and viewpoints for subreddits
subreddits = ['politics', 'technology', 'science']
filepath = 'output_{}.json' # Output file pattern
main(subreddits, filepath, model='gpt-4o')The script performs three steps:
- Topic Generation: Generates controversial topics that would lead to disagreement within each subreddit
- Viewpoint Generation: Creates viewpoints representing different sides of each topic
- Viewpoint Shortening: Condenses viewpoints to shorter statements
The data.csv file contains survey responses with the following key variables:
- Participant characteristics:
Age,Gender,Race,Political,Karma,Usage,Posting,WTSC - Community characteristics:
Subreddit,Diversity,Inclusion,Safety,percent(content removal rate),modratio - Topic/Viewpoint:
Topic,Viewpoint,Agreement,Sub_Agree,Incongruency - Outcomes:
Comment_Likelihood,Upvote_Likelihood
@inproceedings{zhao2026spiral,
author = {Dora Zhao and Diyi Yang and Michael S. Bernstein},
title = {Mapping the Spiral of Silence: Surveying Unspoken Opinions in Online Communities},
booktitle = {Proceedings of the 2026 CHI Conference on Human Factors in Computing Systems},
year = {2026}
}