On providing a valid URL to a Reddit Post, sentiment analysis on the post comments is carried out. The sentiment scores thus obtained are shown in a graphical manner, along with the basic details of the post such as title, date of submission, upvotes etc.
Hosted on Heroku, here.
Reddit is a widely used social media website, with emphasis on social news aggregation, discussion and user content. In this project, we carry out sentiment analysis on the comments of a particular post, and show the results in graphical form. The extraction of comments is done using the Python Reddit API Wrapper(PRAW), the front-end is developed using Dash Plotly, the sentiment analysis is performed using TextBlob, and the project is hosted on Heroku.
- plotly
- dash_core_components
- praw
- dash_html_components
- numpy
- textblob
- dash
- pandas
- dash_bootstrap_components
- gunicorn(only needed if deploying on heroku etc, not necesssary if only running locally)
All these dependencies, along with their version numbers, are given in the requirements.txt file. Using that file, you can install all the packages using a single terminal command,
pip install -r requirements.txt
This code WILL NOT run right out of the box!
To initialise the PRAW Agent and to carry out comment extraction, we need to provide certain credentials which are obtained using our Reddit account. Check out how to get these credentials here.
Insert your credentials at line 20 of reddit-demo.py,
reddit = praw.Reddit(client_id = '', client_secret = '', username = '', password = '', user_agent = '')
Now you are ready to run the code locally! To deploy this project on Heroku is a bit more work.
To host your project on Heroku, you obviously need a Heroku account. After that, you also need Git and Heroku Command Line Interface(CLI) installed. Know more about it here.
Once you have done all the above-mentioned steps, follow the simple steps for Heroku deployment provided here.
NOTE :
- You do not need the requirements.txt, or Procfile, to run the project locally. They are necessary to deploy the application on Heroku.
- Creating a virtual environment isn't mandatory, even though it is a good practice. If you are not using a virtual environment, you do not necessarily need a .gitignore file. So you can avoid those steps.