Whilst there are already many amazing and detailed guides out there on how to run sentiment analysis in Python using VADER, TextBlob, etc, there is not much in-depth information online, bar the generic "Hello, World!" examples, on how to deploy sentiment analysis code live, step-by-step, onto the cloud.
So, in this article I've leaned heavier on how to set this all up (opting for Google Cloud), and gone very light on the NLP data analysis techniques side of things.
We still discuss the main tasks such as deriving polarity and compound scores from text corpus so that we can determine whether it is positive, neutral or negative, but the primary goal of this article is to get those completely new to sentiment analysis, Python and Google Cloud in general, a chance at experimenting and getting something basic live.
We start with setting up a simple workflow with VS Code on a local machine using Python and Google Sheets API to read data from GSheets and analyse the corpus using VADER. We then move onto configuring Google Cloud Functions directly from the GCP interface.
Full Python code examples below.
A Cloud Function recipe for sentiment analysis
π https://towardsdatascience.com/sentiment-analysis-on-google-sheets-with-vader-using-python-and-google-cloud-functions-e767985ed27dπ Full Python Code (on local): https://github.com/Practical-ML/vader-sentiment-analysis/blob/main/local-main.py
π Full Python Code (updated for Google Cloud Functions): https://github.com/Practical-ML/vader-sentiment-analysis/blob/main/main.py
π The requirements.txt for Cloud Functions: https://github.com/Practical-ML/vader-sentiment-analysis/blob/main/requirements.txt