Skip to content

hein-j/reddit-sentiment-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reddit Sentiment Analysis

preview

About

Ever wonder how a subreddit feels about a certain subject? This script can provide insight. Input the name of a subreddit and a key word/phrase to view bar plot representations of the sentiment analysis.

Built With

Usage

sentiment.py [-h] [--show-neutral] subreddit key

positional arguments:
  subreddit           name of subreddit
  key                 word or phrase you want to run by the subreddit

optional arguments:
  -h, --help          show this help message and exit
  --show-neutral, -n  include neutral words in barplot

Getting Started

Prerequisites

  • Python3 (3.9.5)
  • Conda
    • You are welcome to use other package management systems, but I ran into a lot of trouble with pip on a Mac M1. I installed conda through Miniforge.

Installation

  1. git clone https://github.com/hein-j/reddit-sentiment-analysis.git
  2. cd into project root
  3. Install dependencies (into a virtual environment if you wish)
    1. For conda: conda create --prefix ./venv --file requirements.txt and then conda activate ./venv
    2. If you run into trouble or are not using conda, the dependencies are:
      1. praw
      2. nltk
      3. pandas
      4. emoji
      5. spacy
      6. plotly
  4. Download 'wordnet' and 'vader_lexicon' from nltk (See instructions here)
  5. Download spacy model: python -m spacy download en_core_web_sm
  6. Create a reddit app (See here for help)
  7. Create a praw.ini file in project root. Name the site bot. Include client_id, client_secret, and user_agent. (See here for help)
  8. You should now be good to go 🤘

Contributing

Issues & pull requests are most welcome.

License

Distributed under the MIT License. See License for more information.

Acknowledgements

Big thanks to this article by Jason LZP for getting this project started.

About

Find out how a subreddit feels about a given topic

Topics

Resources

License

Stars

Watchers

Forks

Languages