Movie review sentiment analyzer robot
May 2021: The movie review site seems to be currently broken, so this robot does not work at the moment.
There was an attempt to compliment. Or was there...?
Analyzing human language. How hard can it be?
As some of you might have noticed from the above examples, interpreting the actual meaning of a phrase is not always as easy as one might think. The rest of you can return to the top of the bell curve, thanks, that would be great!
An insult disguised as a compliment? A compliment wrapped in a thick layer of sarcasm? A human language is a powerful tool for expressing feelings. One short phrase can contain many well or not so well hidden meanings.
What has all this to do with our robot? Where's my coffee? How much wood would a woodchuck chuck if a woodchuck could chuck wood? Let's find out! At least for the robot part...
A study of a failure
The assistant to the regional manager of the Acme Movie Studios had asked the Department of Very Important Tasks to collect some positive reviews for their new movies. These positive and praising reviews could be used to attract more audience. Everyone wants to see a great movie, right? Right.
The team at the Department of Very Important Tasks was super busy, though. Coffee needed brewing, gossip required spreading. Jane's neighbor had a brand new and expensive Chihuahua. How did she afford it?!
An automated solution for collecting positive reviews and discarding the negative reviews was called for. Soon. As in "yesterday". And could it have a bit more yellow, and could you use Comic Sans for... everything? Thanks, dear!
The task was assigned to the one and only person in the company doing actual real work... I mean... Ehm. Anyway. Eric, the engineer, was given the task to automate-all-the-things. There was no budget nor planning, nobody to ask requirements from. The typical project at Acme Movie Studios. Eric started hacking away.
Eric hacked away with no budget nor specifications to automate the collection of reviews from the movie review site (click on the Movie Search
link on the site to find the movie search section).
The following is what Eric came up with. If you want to, you can try and fail as miserably as he did. Don't worry; it does not hurt that much. Follow along!
The robot:
- Uses either Free Sentiment Analyzer or Amazon Comprehend
- Searches popular movies
- Starts and completes the review classification (positive vs. negative)
- Submits the classification and captures the final results
Setup
You need AWS credentials to use Amazon Comprehend. You can create a IAM user with limited access to the Amazon Comprehend API. It is not recommended to use your AWS root user credentials.
After setting up the AWS credentials, the robot is almost ready to run, but still needs the vault for the AWS credentials. See how to use a vault for secrets on how to set up the vault.
Paste this content in the vault file:
Also set up the vault in Control Room, if you want to run the robot there.
Robot script
Modify AWS_REGION
variable to control AWS region. Change USE_COMPREHEND
to True
when you want to use Amazon Comprehend for sentiment analysis.
Task failed successfully
I would have given this LESS than a 1 rating if it were possible. The entire film should have been left on the cutting-room floor. What a pathetic waste of time, money and effort! Let's see...assemble the prettiest cast you can find (which of course is in direct proportion to the amount of talent they lack)...throw together the thinnest plot you can dig up...and viola! An abominable piece of trash that the director and/or producer should be ashamed to put their name on. How much WORSE can the horror genre get? And don't use low budget as an excuse...I have seen many GREAT low-budget films....in fact some of the best horror classics of all time were low-budget. If you don't have the talent and ingenuity to make a GOOD horror film, then for God's sake don't make one at all!!!
To put it short. Eric was fired. The assistant to the regional manager was promoted. A new developer-to-blame was hired, straight from the elementary school. You know the story!
What did we learn?
Well. The robot did stuff, which is great.
The robot used two browsers, switching between the movie review website and the sentiment analysis website. This enables automating processes that use multiple separate systems, jumping between the systems as required.
The robot was able to switch between sentiment analysis services using conditional constructs and variables.
We learned that Robot Framework keywords could be expressive and use rich language, if needed (see the main task).
The robot outsourced the hard part of analyzing human language to an external service. Building a machine-learning-based solution inhouse was out of the question due to OutOfBudgetException. Outsourcing a part of the automation process makes sense in these scenarios.
However, we also learned that not all services are an automatic fit for all problems. One needs to carefully select the services based on the business needs, and do proper testing, to see if the solution works.
As for the possible "proper" solution for language analysis: Many of the large cloud service providers offer paid cloud-based services. It might be a good idea to test those offerings for your real-world needs.
- Amazon Comprehend - Natural Language Processing (NLP) and Machine Learning (ML)
- Cloud Natural Language | Google Cloud
- Text Analytics API - Microsoft Azure
Good luck on your journey in your own Acme Movie Studio projects! Hang in there!