concept sentiment weight in category nlp

appears as: sentiment weight, sentiment weights, sentiment weight, sentiment weights
Getting Started with Natural Language Processing

This is an excerpt from Manning's book Getting Started with Natural Language Processing.

Let’s assume that our comprehensive sentiment words lexicon doesn’t just list the words as positive or negative, it also has some weights assigned to them. Then a simple algorithm can estimate the overall sentiment of a review as a sum of the individual words’ sentiment weights. For instance, let’s assume that some sentiment lexicon assigns sentiment weights to the 6 words from our review above as shown in Table 7.1. Then at each step the algorithm updates the total sentiment score with each word’s sentiment weight, as the rightmost column of the table shows. In the end, the algorithm will accumulate 0.96 as the final score, which, being a positive number, suggests an overall positive sentiment for the given review.

Table 7.1 Aggregation of the total sentiment score from individual words’ sentiment weights

Word

Sentiment weight

Total

shocked

-1.47

0-1.47=-1.47

liked

+2.18

-1.47+2.18=0.71

hideous

-3.33

0.71-3.33=-2.62

grotesque

-2.16

-2.62-2.16=-4.78

wonderfully

+3.61

-4.78+3.61=-1.17

pleasant

+2.13

-1.17+2.13=0.96

Figure 7.7 Imagine that the total sentiment is expressed by the temperature of the contents. Each positive word warms the content up, while each negative word cools it down according to sentiment weights

If you run the code from this listing unmodified, here is what you will learn: “cool” hasn’t changed its polarity between the 1990s and the 2000s – it has stayed quite a positive word throughout. Its sentiment strength, though, did drop slightly, from 1.28 in the 1990s to 1.19 in the 2000s. There are 1,968 adjectives in the 1990s adjectives lexicon and 2,041 in the 2000s one. As for the all frequent words data, both 1990s and 2000s lexicons contain 4,924 words – that is how many words are left of the most frequent 5,000 ones once the stopwords are filtered out (the selection of 4,924 and the sentiment weights are quite different though!). Finally, the movies lexicon contains 4,981 words in total – again, the result of filtering out stopwords among the most frequent 5,000 words used in the movies community. Recall from the data exploration section 7.3 that the total size of positive and negative vocabulary is within the range of 34,000-37,000 of words, i.e. much larger than these lexicons contain. At the same time, the sizes of the adjective vocabularies are comparable to the sizes of the adjective lexicons. The idea behind using lexicons is that they contain smaller but more informative sets of words. Let’s see if this helps detecting review polarity.