The viewer is disabled because this dataset repo requires arbitrary Python code execution. Please consider
removing the
loading script
and relying on
automated data support
(you can use
convert_to_parquet
from the datasets
library). If this is not possible, please
open a discussion
for direct help.
Reddit Political Discourse Dataset
Data Source
Pushshift Archive: Pushshift is a social media data collection, analysis, and archiving platform that has collected Reddit data since 2015, offering real-time updates as well as historical data dating back to Reddit's inception. I downloaded the relevant files from this data by predetermining which subreddits to work on and used Zapier to split the file into manageable csv files. I've included a python file that demonstrates how I filtered those csv files. I also filter the data based on top posts (by score) and from 2014 onwards. (Found in data_cleaning.py
.)
Dataset Description
This dataset is a curated collection of posts from 9 prominent US politics-oriented subreddits known for their wide range of political views. The selected subreddits include: r/politics, r/democrats, r/Conservative, r/The_Donald (now banned), r/SandersForPresident, r/JoeBiden, r/LateStageCapitalism, and r/socialism.
Data Collection
The dataset comprises the top posts from the selected subreddits for each year starting from 2014. The raw data files from Pushshift were processed to enhance manageability and accessibility.
Dataset Structure
Each row in the dataset represents a single post and includes the following columns:
- Author: The username of the individual who submitted the post.
- Created UTC: The date and time when the post was created, typically represented as a UNIX timestamp and can be converted to a more readable datetime object.
- Domain: The internet domain of the linked content in the post. For example, i.imgur.com for images hosted on Imgur. For self-posts, this might just point to the subreddit domain.
- Title: The title of the Reddit post, as specified by the author.
- Selftext: The body text of the post. For link posts, this is often empty, whereas for text (self) posts, this contains the post's content.
- Subreddit: The name of the subreddit where the post was submitted.
- Score: The net score of the post, calculated as the difference between the number of upvotes and downvotes.
- Number of Comments: The total count of comments made on the post.
- Ups: The number of upvotes the post has received. Note that Reddit may fuzz the actual numbers of upvotes and downvotes.
- Downs: The number of downvotes the post has received. As with upvotes, the exact count may be fuzzed by Reddit.
- Permalink: A relative URL to the Reddit post. This can be appended to https://www.reddit.com to form the complete URL.
- Is Self: A boolean indicating whether the post is a self-post (text post) or a link post. Self-posts contain text content, while link posts link out to external content.
- URL: The direct URL to the linked content for link posts. For self-posts, this may point to the Reddit post itself.
- Subreddit Subscribers: The number of subscribers to the subreddit at the time of the post. This gives an idea of the subreddit's size.
- Upvote Ratio: The ratio of upvotes to total votes (upvotes plus downvotes) the post has received.
- Is Original Content (OC): A boolean indicating whether the post has been marked as original content by the author.
- Media: Information or metadata about any media associated with the post, such as videos or images. This can vary widely in format depending on the post and media type.
- Selftext HTML: The HTML version of the selftext, allowing for embedded formatting and links. This may be useful for rendering the post's content as it appears on Reddit.
- Author Flair Text: Text of the flair attached to the author's username in the context of the subreddit. Flairs can denote specific roles, achievements, or statuses within the subreddit community.
- Link Flair Text: The text of the flair attached to the post itself. Subreddits use link flairs to categorize posts, indicate post status, or convey other information.
- Image (PIL object): For datasets including image analysis, this could be a Python Imaging Library (PIL) object representing an image associated with the post. This allows for direct manipulation and analysis of post images.
- Image Text: A generated feature that might represent text extracted from an associated post image using techniques like Optical Character Recognition (OCR). This can provide additional context or content for analysis, especially for image-heavy posts. (Found in
data_preprocessing.py
.)
URL Content Processing
The dataset includes a URL attribute, which can point to an image or an external article. The content from these URLs is processed to extract textual information, which enriches the dataset with additional context for each post. Here's an overview of how the URLs are handled:
Image URLs: For URLs that point to images (identified by their file extension), the image is downloaded to a local directory. Each image is then validated to ensure it is properly formatted and not corrupt. If valid, optical character recognition (OCR) is performed on the image using
pytesseract
, converting any text in the image into a string.Article URLs: For URLs presumed to point to articles (not ending in typical image file extensions), a heuristic is applied to extract meaningful text directly from the URL itself. This involves parsing the URL's path, extracting segments, and replacing common URL encodings (such as hyphens and underscores) with spaces to form a readable string.
Text Inclusion: The extracted text, whether from images or article URLs, is then associated with the corresponding post entry in the dataset. This provides an expanded dataset where users can analyze not only the metadata of the Reddit post but also content referenced by external links.
This process is designed to handle a wide range of content types and to be robust against common issues such as download errors or invalid image files. It enhances the dataset by providing a more comprehensive view of the post's content and the discourse it is a part of.
Impact
The political discourse on Reddit provides a rich landscape for research. This dataset not only contains textual content but also images (linked via the 'url' attribute) and sometimes links to external articles, offering a diverse mix of content that can help analyze and understand the propagation of political discourse.
Limitations
The dataset is a subset of top posts and does not represent the entirety of posts within the selected subreddits. Comments can potentially be harvested using the 'permalink' attribute and OAuth procedures, which may be included in future updates. Some images and articles have not been processed due to authentication issues with Imgur and other cases where content has been removed or banned.
License
Citation
Changelog
Contact Information
- Downloads last month
- 59