Using empath to analyze movie reviews

More and more businesses are now leveraging on their knowledge of what the customers want through feedback and reviews to improve their business processes. Thus, the ability to capture and understand the customers fast is now the real game among enterprises. A lot of tools were already being used by large companies to acquire and monitor customer sentiments.

In this post, we will try to understand how Natural Language Processing (NLP) can be used to analyze languages, specifically on movie reviews, and how businesses can use it to analyze the change in behavior of consumer preferences. We would be using an open-source tool called Empath.

Empath is a tool to analyze text across lexical categories similar to Linguistic Inquiry and Word count (LIWC) – commonly used by researchers. It “analyzes text across 200 built-in, pre-validated categories generated from common topics in the web” [1].  It provides a numerical representation for each category as analyzed by content. It addresses the limitation of LIWC which only analyzes text across only 40 topics.

We have managed to acquire compiled data of movie reviews from [2] which was first used by Pang and Lee in [3]. These are numerous film reviews from known film critic and personalities such as Dennis Schwartz, James Berardinelli, etc. that are pre-processed and stored in a .txt file format.

Prepare Data

We first load necessary libraries we need for our analysis and set up the list in which we will do the analysis on.

Main Analysis

Then, we perform the operation on a for loop to analyze all the .txt files in one execution. Lastly, we store our data frame in a .csv file.

Examine the Data

It is probably a bit overwhelming to look at all the numbers obtained from those numerous reviews examined. Perhaps, why don’t we have a closer look on one of the examples we just had. Examining the results of one of the reviews we looked at by Dennis Schwartz, it states that

“…This is an obscure Bela Lugosi film and it’s not bad. Ellis is the dame with class. She sings the happy tune ‘Bluebirds on wallpaper decorating our dreams.’ Bela’s the bad guy with a foreign accent. His fans will love him here, as this film has been restored recently and is now watchable.

This is a review on the film ‘Postal inspector’ last 2001. See full review here. The review circulates on what the characters do to live and what they do to survive their own circumstances. With that, the result of applying empath is summarized below.

Bar plot of empath results in Schwartz’ movie review of Postal Inspector

Based on the chart above, occupation, business, music and listen are the top 4 categories found after analysing the text using empath. Now, let’s try to go back to the text and check what could have probably contributed to the high scores.

First, occupation. If we are to go back to the full review and get some key words which might have resulted to a high empath score on occupation, we will find phrases like good work, job, and works for the post office. For business, things like shady owner of a prominent nightclub. Lastly, for music and listen, we have nightclub singer, sing to the passengers, and sing at the nightclub.

There you go! You can now start examining your own texts and see how it’s interpreted when applied with empath.

References

  1. Fast, E., Chen, B., Bernstein, M.S. (2016). Empath: Understanding Topic Signals in Large-Scale Text. Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems. pp. 4647-4657. USA CA, San Jose. DOI: http://dx.doi.org/10.1145/2858036.2858535.
  2. Movie Review Data. www.cs.cornell.edu/people/pabo/movie-review-data/ . Accessed on November 21, 2018.
  3. Bo Pang and Lillian Lee. Seeing Stars: Exploiting class relationships for sentiment categorization with respect to rating scales. Proceedings of ACL. 2005.