Dictionary Approach II: Sentiment Analysis

Another dictionary approach uses outside word lists to investigate the sentiment of text. Essentially, that means that we count words with positive and negative connotation in a document to assess the sentiment or tonality of a document. 

For example, political scientists have used sentiment analysis to investigate whether judges change their tone when dealing with particularly sensitive cases. We repeat a similar analysis here. The same approach, but with a different dictionary, could be used to look at other characteristics of legal texts, such as their prescriptivity, flexibility or use of legalese or outdated terms. 

Let’s start by downloading and activating the SentimentAnalysis package and by taking a look at its inbuilt sentiment dictionaries.

#Load package

library("SentimentAnalysis")

# The package comes with existing word lists of positive and negative words.

head(DictionaryGI$positive)
 ##
[1] "abide"     "ability"   "able"      "abound"    "absolve"   "absorbent"


head(DictionaryGI$negative)

 ##
[1] "abandon"     "abandonment" "abate"       "abdicate"    "abhor"       "abject" 

Next, we want check how many of these positive and negative words exist in each text of our corpus. Do judges tend to use more positive or more negative language when framing their decisions.

# We count how many of  positive and negative words exist in each text .
tdm <- TermDocumentMatrix(corpus)
text_sentiment <- analyzeSentiment(tdm)

 

When positive words outnumber negative ones, we classify a text as positive and vice versa. This is of course only an approximation but may nevertheless be helpful to group texts.




table(convertToBinaryResponse(text_sentiment)$SentimentGI)

 ## negative positive
0 25

As it turns out, all judgments use more positive words than negative words.

access_time Last update May 11, 2020.

chat networking coding local-network layer menu folders diagram panel route line-chart compass search flow data-sharing search-1 message target translator candidates studying chat networking coding local-network layer menu folders diagram panel route line-chart compass search flow data-sharing search-1 message target translator candidates studying